BITXOR
Returns the bitwise exclusive OR of two non-negative integers.
Keeps bits that differ between the two inputs.
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
=BITXOR(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 =BITXOR(12,10)
Expected result 6
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 =BITXOR(12,12)
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?.
Apply the bit operation to two zero operands.
Formula =BITXOR(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 =BITXOR(-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?.
Highlight differing bits
Formula =BITXOR(13,10)
Expected result 7
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?.
XOR identical values
Formula =BITXOR(5,5)
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?.
Related functions
FAQ
Why does BITXOR(x, x) return 0?
XOR keeps only differing bits; identical operands cancel every bit position.