The BITAND function in Excel is designed for users who need to perform binary calculations, specifically the bitwise AND operation. This function allows you to compare two numbers and returns a number that represents the set bits in both operands.
Syntax
The syntax for the BITAND function is as follows:
BITAND(number1, number2)
– number1: The first number to compare.
– number2: The second number to compare.
Example
If you use the formula:
=BITAND(5, 3)
Here’s what happens:
- The binary representation of 5 is
101
. - The binary representation of 3 is
011
. - Performing a bitwise AND operation on these gives
001
, which is1
in decimal.
So, =BITAND(5, 3)
returns 1
.