EXCEL XOR multiple bits

后端 未结 5 2153
[愿得一人]
[愿得一人] 2021-02-20 05:33

Okay I have two cells with a string of bits 0111010 and 0101011. I want to XOR the two together so that the resulting cell would be 0010001.

I know you can use this for

5条回答
  •  滥情空心
    2021-02-20 05:45

    You need to use VBA to do this. If you open VBA, create a new Module and enter the function

    Public Function BITXOR(x As Long, y As Long)
        BITXOR = x Xor y
    End Function
    

    You can then use the DEC2BIN and BIN2DEC to convert from binary to decimal to run this function. For example:

    Cell A1 = 0111010

    Cell A2 = 0101011

    =DEC2BIN(BITXOR(BIN2DEC(A1),BIN2DEC(A2)))
    

提交回复
热议问题