Bitwise Arithmetic

The following bitwise arithmetic functions are provided in the Real Statistics Resource Pack with functionality similar to the standard Excel functions BITAND, BITOR, BITXOR, BITLSHIFT and BITRSHIFT that were introduced with Excel 2013. These new Real Statistics functions may be useful to Excel 2007, 2010 and 2011 users.

Real Statistics Functions: The Real Statistics Resource Pack contains the following functions.

BIT_AND(m, n) = bitwise And of the binary values of the integers m and n

BIT_OR(m, n) = bitwise Or of the binary values of the integers m and n

BIT_AND(m, n) = bitwise Xor of the binary values of the integers m and n

BIT_LSHIFT(m, shift) = bitwise result of shifting the binary equivalent of the integer m shift units to the left (if omitted, shift defaults to 1)

BIT_RSHIFT(m, shift) = bitwise result of shifting the binary equivalent of the integer m shift units to the right (if omitted, shift defaults to 1)

Examples: Figure 1 shows how to use these functions. Note that BIN2DEC is a standard Excel function that converts a text string containing a binary number into the equivalent decimal value. Similarly, DEC2BIN is a standard Excel function that converts a decimal number representing a positive integer into a text string containing a binary number.

Bitwise arithmetic examples

Figure 1 – Bitwise arithmetic examples

Reference

Microsoft (2019) BITRSHIFT function
https://support.microsoft.com/en-us/office/bitrshift-function-274d6996-f42c-4743-abdb-4ff95351222c

Leave a Comment