The BITAND function returns a bitwise ‘AND’ of two numbers
- This function was introduced in Excel 2013 and so is not available in earlier versions.
|num_1||Must be in decimal form and greater than or equal to 0|
|num_2||Must be in decimal form and greater than or equal to 0|
Note: BITAND returns a decimal number
- The value of each bit position is counted only if both parameter’s bits at that position are 1
- The values returned from the bit positions progress from right to left as powers of 2. The rightmost bit returns 1 (2^0), the bit to its left returns 2 (2^1), and so on
|2||=BITAND(1,5)||Compares the binary representations of 1 and 5||1||The binary representation of 1 is 1, and the binary representation of 5 is 101. Their bits match only at the rightmost position. This is returned as 2^0, or 1|
|3||=BITAND(13,25)||Compares the binary representations of 13 and 25||9||The binary representation of 13 is 1101, and the binary representation of 25 is 11001. Their bits match at the rightmost position and at the position fourth from the right. This is returned as (2^0)+ (2^3), or 9|
Common Function Error(s)
|Problem||What went wrong|
|#VALUE!||Occurs if one or both of the supplied num arguments is non-numeric|
|#NUM!||Occurs if either:
The Excel Bitwise functions convert the supplied integer value(s) to binary form and then perform an operation on the individual bits.
The result is then converted back to an integer value before being returned.
Further information on Bitwise operations is provided on the Wikipedia Bitwise Operation Page