Is there an XOR function??

  • Thread starter Thread starter Luke
  • Start date Start date
Luke wrote...
How do I Xor two values together using a calculation?

For up to 32-bit integers,

=SUMPRODUCT(MOD(MOD(INT(A1/2^(32-ROW(INDIRECT("1:32")))),2)+MOD(INT(A2/2^(32-ROW(INDIRECT("1:32")))),2),2),2^(32-ROW(INDIRECT("1:32"))))
 
CoRrRan wrote...
...
=BIN2DEC(SUBSTITUTE(DEC2BIN(A1)*1+DEC2BIN(B1)*1;2;0))

Note that BIN2DEC and DEC2BIN both require the Analysis ToolPak, an
both can handle numbers only up to 511. Also note that comma rathe
than semicolon is the typical argument separator for English languag
versions of Excel
 
Would a Custom Function work for you?

Function BitXor(a, b)
BitXor = a Xor b
End Function

Here, A1 & B1 have the following two values:
123456789
987654321

=BitXor(A1,B1)

returns:
1032168868

Which seems to check with another program:
BitXor[123456789, 987654321]

1032168868

BitXor means a 'bit'wise Xor.
Hope I did this correctly. :>)
Dana DeLouis
 
Hmmm. Never mind. Although "Help" says that a & b can be any expression,
it looks like they are limited to a size of "Long", or about 9-10 digits.

Dana


Dana DeLouis said:
Would a Custom Function work for you?

Function BitXor(a, b)
BitXor = a Xor b
End Function

Here, A1 & B1 have the following two values:
123456789
987654321

=BitXor(A1,B1)

returns:
1032168868

Which seems to check with another program:
BitXor[123456789, 987654321]

1032168868

BitXor means a 'bit'wise Xor.
Hope I did this correctly. :>)
Dana DeLouis

Luke said:
How do I Xor two values together using a calculation?

Cheers
 
It seems to work,

Thank you for your reply.

Regards,
Luke
-----Original Message-----
Hmmm. Never mind. Although "Help" says that a & b can be any expression,
it looks like they are limited to a size of "Long", or about 9-10 digits.

Dana


Dana DeLouis said:
Would a Custom Function work for you?

Function BitXor(a, b)
BitXor = a Xor b
End Function

Here, A1 & B1 have the following two values:
123456789
987654321

=BitXor(A1,B1)

returns:
1032168868

Which seems to check with another program:
BitXor[123456789, 987654321]

1032168868

BitXor means a 'bit'wise Xor.
Hope I did this correctly. :>)
Dana DeLouis

How do I Xor two values together using a calculation?

Cheers


.
 
Back
Top