Related Function:

The BITOR function returns a bitwise ‘OR’ of two numbers

  • This function was introduced in Excel 2013 and so is not available in earlier versions.

Syntax

=BITOR(num_1,num_2)

Arguments

Argument Description
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

Examples

  A B C D
1 Formula Description Result Notes
2 =BITOR(23,10) 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 31 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
3       23 = 10111
4       10 = 01010
5       Test: is 1 found at any of the 5 positions
6       YYYYY
7       1+2+4+8+16 = 31

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:

  one or both of the supplied num arguments is a non-integer
  one or both of the supplied num arguments is negative or is greater than (2^48)-1

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