BITOR

BITOR(number1, number2)

Returns the bitwise OR of two numbers.

number1The first number.
number2The second number.

REMARKS
* The value of each bit position is counted if either of the parameters has a 1 is 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 BITAND function to return the bitwise AND 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=BITOR(23, 10) = 31

1 - Compares the bit positions for the binary representations of the two numbers, and if either position contains 1, returns 2 raised to a power, depending on bit position. Then, those numbers are summed. The number 23 is 10111 in binary, and 10 is 1010. The value 1 is found in either position at all 5 positions of either of the two numbers. You can express 1010 as 01010 so that both numbers have the same number of digits. The numbers 2^0, 2^1, 2^2, 2^3, and 2^4 are summed, for a total of 31.

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