Related Function:

The BITXOR function returns the bitwise ‘XOR’ (exclusive ‘OR’) for two supplied integers.

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

Syntax

=BITXOR(num_1,num_2)

Arguments

Argument Description
num_1 Must be greater than or equal to 0
num_2 Must be greater than or equal to 0

Note: BITXOR returns a decimal number that is the result of the sum of a bitwise ‘XOR’ (exclusive XOR) of its parameters.

  • Each bit position is 1 if the values of the parameters at that bit position are not equal; in other words, one value is 0 and the other is 1. For example, using BITXOR(5,3), 5 is expressed as 101 in binary and 3 as 11 in binary
  • Values of 1 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

Examples

  A B C D
1 Formula Description Result Notes
2 =BITXOR(5,3) Returns the total of the bitwise “Exclusive OR” comparision at each bit position 6 The number 5 is 101 in binary, and 3 is 11. You can express 11 as 011 so that both numbers have 3 digits. A bitwise ‘Exclusive Or’ comparison checks to see if both digits at each position are not equal and, if true, returns a positive value for that position
3        
4       Test: at which positions are the digits not equal?
5       5 = 101 in binary
6       3 = 011 in binary
7       YYN
8       (1*(2^2))+(1*(2^1))+(1*0)
9       4+2+0 = 6

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