The `BITXOR` function in Excel is used to perform a bitwise “exclusive OR” operation on two numbers. This function compares the binary representations of two numbers and returns a decimal number as a result. Each bit in the resulting number is set to 1 if and only if the corresponding bits of the two numbers being compared are different.
Here is how you can use the `BITXOR` function in Excel:
Syntax
BITXOR(number1, number2)
- number1: The first non-negative integer (required).
- number2: The second non-negative integer (required).
Steps to Use BITXOR Function
- Open Excel: Launch Microsoft Excel and open a new or existing worksheet.
- Enter Numbers: Decide on the two numbers you want to perform the BITXOR operation on. For instance, use cells `A1` and `B1` for input numbers.
- Type the Formula:
- Click on the cell where you want to display the result.
- Type `=BITXOR(` and then select the first cell containing the number, for example, `A1`.
- Type a comma `,` and then select the second cell with the number, for example, `B1`.
- Close the parenthesis `)` and press `Enter`.
Example Formula:
=BITXOR(A1, B1)
- Result: The formula will calculate the bitwise XOR of the numbers in `A1` and `B1` and display the result in the selected cell.
Example
Suppose you have the numbers 5 and 3:
- Binary of 5: 101
- Binary of 3: 011
Performing a bitwise XOR operation:
101
XOR 011
------
110
The binary result `110` is equal to 6 in decimal. Thus, `=BITXOR(5, 3)` will return 6.
Notes
- Ensure both numbers are non-negative integers; otherwise, Excel will return an error.
- The `BITXOR` function is available in Excel 2013 and later versions.