the BITXOR function

Contents

Welcome back to our usual blog of Excel functions from A to Z. Today we look at the BITXOR function.

The BITXOR function

This function returns a bitwiseXOR'Of two numbers (XOR was first introduced in Excel 2013 Y, at the current rate of publication of these posts, we should get to this in 2044). Essentially, BITXOR convert two numbers into binary expressions and compare the digits in each position from right to left. If the values ​​are not equal, the function returns a 1 for that position (bit). For each 1, its position is determined and converted to a power of 2 (2 ^ 0 for the rightmost position, 2 ^ 1 for the value to your left, 2 ^ 2 for the value to the left of this and so on). Then, add these corresponding powers of two.

The BITXOR The function uses the following syntax to operate:

The BITXOR The function has the following arguments:

  • number 1: This is mandatory and must be greater than or equal to 0
  • Number 2: additionally required. Must be greater than or equal to 0.

It should be noted at the same time that:

  • BITXOR returns a decimal number that is the result of the sum of a bit by bit ‘XOR‘ (exclusive XOR) of its parameters
  • if any of the arguments are outside your constraint, BITXOR return the #ON ONE! error value
  • if any of the arguments is greater than (2 ^ 48) -1, BITXOR return the #ON ONE! error value
  • if any of the arguments is a non-numeric value, BITXOR return the #VALUE! error value
  • in the result, each bit position is 1 if the parameter values ​​in that bit position are not the same; In other words, a value is 0 and the other is 1. As an example, using BITXOR (5,3), 5 is expressed as 101 in binary and 3 What 11 in binary. To help with comparison, can consider 3 What 011. From right to left, the bit values ​​at all three positions in this example are the same (1) only in the rightmost position. A result 'not equal’ returns a 1 for the second and third position from the right, and a result 'equal’ bring back 0 for the rightmost position
  • the values ​​of 1 returned from the bit positions progress from right to left as powers of 2. The bit on the right returns 1 (2 ^ 0), the left bit returns 2 (2 ^ 1), and so on
  • using the same example, It is returned 0 for the rightmost bit position because it is a 0, It is returned 2 (2 ^ 1) for the position of the second bit from the right (a value of 1) and it returns 4 (2 ^ 2) for the leftmost bit (also a value of 1). The total is 6, in decimal representation.

Please, see my example below:

Subscribe to our Newsletter

We will not send you SPAM mail. We hate it as much as you.