A to Z of Excel Functions: The BITOR Function
3 March 2017
Welcome back to our regular A to Z of Excel Functions blog. Today we look at the BITOR function.
The BITOR function
I’m starting to get used to these functions now, well a BIT anyway (get it?). This function returns a bitwise ‘OR’ of two numbers. In this variant, this means that the value of each bit position (the corresponding number reading from right to left when represented in binary) is counted if any of the parameter's bits at that position are 1.
The BITOR function employs the following syntax to operate:
The BITOR function has the following arguments:
- number1: this is required and must be in decimal form, greater than or equal to 0
- number2: also required. This must be in decimal form and greater than or equal to 0.
It should be further noted that:
- the result is a bitwise 'OR' of its parameters
- in the result, each bit position is 1 if any of the parameter's bits at that position are 1
- the values returned from the bit positions progress from right to left as powers of 2. The rightmost bit returns 1 (2^0), the bit to the left returns 2 (2^1), and so on
- if either argument is outside their constraints, BITOR returns the #NUM! error value
- if either argument is greater than (2^48)-1, BITOR returns the #NUM! error value
- if either argument is a non-numeric value, BITOR returns the #VALUE! error value.
Please see my example below:
We’ll continue our A to Z of Excel Functions soon. Keep checking back – there’s a new blog post every other business day.