BITOR
Returns the bitwise OR of two non-negative integers.
Combines matching bits from both inputs and keeps bits set in either number.
The Formualizer engine in this repository at 0.15.0 plus unreleased changes computes the example results. Known differences from Excel are listed on this page.
Syntax
=BITOR(number1, number2)
Arguments
| Argument | Type | Required | Default |
|---|---|---|---|
number1 | number | Required | — |
number2 | number | Required | — |
Remarks
- Arguments are coerced to numbers and must be whole numbers in the range
[0, 2^48). - Propagates input errors.
Error cases
- Returns
#NUM!for negative values, fractional values, or out-of-range values.
Examples
Combine two integers whose binary representations partly overlap.
Formula =BITOR(12,10)
Expected result 14
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Compare the result when both operands have identical bits.
Formula =BITOR(12,12)
Expected result 12
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Apply the bit operation to two zero operands.
Formula =BITOR(0,0)
Expected result 0
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Negative operands are outside the supported integer domain.
Formula =BITOR(-1,10)
Expected result #NUM!
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Merge bit flags
Formula =BITOR(13,10)
Expected result 15
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Set an additional bit
Formula =BITOR(8,1)
Expected result 9
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Related functions
FAQ
Does BITOR accept decimal-looking values like 3.0?
Yes if they coerce to whole integers; non-integer values still return #NUM!.