Home » ExcelBuiltInFunctions » ExcelEngineeringFunctions » ExcelBitorFunction
The Excel BITOR Function
Bitwise Functions
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
Related Functions:
BITANDBITXORFunction Description
The Excel BitOr function returns the bitwise 'OR' for two supplied integers.
Note: the BitOr function was only introduced in Excel 2013 and so is not available in earlier versions of Excel.
The syntax of the function is:
BITOR( number1, number2 )
where the supplied number arguments are positive integers.
BitOr Function Examples
Example 1
Formula:  A  B 

1  =BITOR( 5, 6 )  (5 and 6 have binary forms 101 and 110) 

2   

 Result:  A  B 

1  7  (decimal form of 111) 

2   


In the above example:
DecimalBinary Conversion
If you want to work through the stages of a bitwise 'OR' operation you can use the Excel
DEC2BIN and
BIN2DEC functions to convert between decimal and binary forms.
 The binary form of 5 is 101.
 The binary form of 6 is 110.
 One or both of the binary numbers 101 and 110 has the digit '1' at positions 1, 2 and 3 (counting from the right).
 The bitwise 'OR' result is therefore the binary number that has a '1' in positions 1, 2 and 3 (from the right). I.e. the binary number 111.
 This number is returned in decimal form, as the integer 7.
Example 2
Formula:  A  B 

1  =BITOR( 9, 12 )  (9 and 12 have binary forms 1001 and 1100) 

2   

 Result:  A  B 

1  13  (decimal form of 1101) 

2   


In the above example:
 The binary form of 9 is 1001.
 The binary form of 12 is 1100.
 One or both of the binary numbers 1001 and 1100 has the digit '1' at positions 1, 3 and 4 (counting from the right).
 The bitwise 'OR' result is therefore the binary number that has a '1' in positions 1, 3 and 4 (from the right). I.e. the binary number 1101.
 This number is returned in decimal form, as the integer 13.
Further information and examples of the Excel BitOr function are provided on the Microsoft Office website.
BitOr Function Errors
Common Errors
#NUM!    Occurs if either:  One or both of the supplied number arguments is a noninteger;
 One or both of the supplied number arguments is negative or is greater than (2^48)1.

#VALUE!    Occurs if one or both of the supplied number arguments is nonnumeric. 