< Back

BITXOR function

Sun Jul 21, 2019 1:24 am

BITXOR function



This article describes the formula syntax and usage of the BITXOR function in Microsoft Excel.



Description Returns a bitwise 'XOR' of two numbers.



Syntax BITXOR(number1, number2) The BITXOR function syntax has the following arguments.
  • Number1 Required. Must be greater than or equal to 0.
  • Number2 Required. Must be greater than or equal to 0.




Remarks
  • BITXOR returns a decimal number that is the result of the sum of a bitwise 'XOR' (exclusive XOR) of its parameters.
  • If either argument is outside its constraint, BITXOR returns the #NUM! error value.
  • If either argument is greater than (2^48)-1, BITXOR returns the #NUM! error value.
  • If either argument is a non-numeric value, BITXOR returns the #VALUE! error value.




The Symbol for XOR gate is:



Image



Where A and B are inputs and X is the result. The result for each bit combination is as per the table below:



A


B


X


0


0


0


0


1


1


1


0


1


1


1


0


Example Copy the example data in the following table, and paste it in cell A1 of a new Excel worksheet. For formulas to show results, select them, press F2, and then press Enter. If you need to, you can adjust the column widths to see all the data.


Formula


Description


Result


=BITXOR(7,5)


Returns the total of the bitwise "Exclusive Or" comparision at each bit position.


2


How is it Calculated?

7 in Binary : 0111

5 in Binary : 0101

0111 XOR

0101

=0010

Decimal of 0010 : 2