Strange results with BITXOR in Excel

Posted on

QUESTION :

I get the following results with Excel 2016 MSO (16.0.6701.1011) 64-bit:

=BITXOR(10,1111)

produces:

1117

I expected 1101.

However =BITXOR(10,111) produces 101 which is what I expected.

Is this a bug or am I missing something obvious?

ANSWER :

This is the result, if 1111 and 10 are decimal. If u watch this binary, it looks like it should do:

  10 =        1010b
1111 = 10001010111b
----------XOR----------
       10001011101b = 1117

So you have to convert your numbers to decimals first.

Leave a Reply

Your email address will not be published. Required fields are marked *