BITAND

BITAND(number1, number2)

Returns the bitwise AND of two numbers.

number1The first number.
number2The second number.

REMARKS
* This function returns a decimal.
* The value of each bit position is counted only if both parameters have a 1 at that position.
* If "number1" < 0, then #NUM! is returned.
* If "number2" < 0, then #NUM! is returned.
* If "number1" is not an integer, then #NUM! is returned.
* If "number2" is not an integer, then #NUM! is returned.
* If "number1" > (2^48)-1, then #NUM! is returned.
* If "number2" > (2^48)-1, then #NUM! is returned.
* If "number1" is not numeric, then #VALUE! is returned
* If "number2" is not numeric, then #VALUE! is returned
* You can use the BITOR function to return the bitwise OR of two numbers.
* You can use the BITXOR function to return the bitwise Exclusive OR of two numbers.
* This function was added in Excel 2013.
* For the Microsoft documentation refer to support.microsoft.com

 A
1=BITAND(1, 5) = 1
2=BITAND(13, 25) = 9

1 - Compares the binary representations of 1 and 5. 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.
2 - Compares the binary representations of 13 and 25. 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.

© 2025 Better Solutions Limited. All Rights Reserved. © 2025 Better Solutions Limited Top