bitwise operations as in xor

  • Thread starter Thread starter stevenshrii
  • Start date Start date
stevenshrii said:
is there an Xor operation in excel for a bitwise functions ?

No in Excel per se, to my knowledge. But there is an XOR operator in VBA.
For example:

Function myxor(lh as Long, rh as Long) as Long
myxor = lh Xor rh
End Function

When we enter =myxor(12,10), the result is 6. Note that 12 in binary is
1100, 10 is 1010, and 6 is 0110. However, keep in mind that Excel stores
numbers internally as binary floating-point.

The above function is limited to 31-bit positive integers. You can use
32-bit integers by treating them as signed integers.
 
Back
Top