1. eXclusive ORing (any)

I have searched this topic in The Lounge, and am trying to use Tony's XOR implementation =AND(OR(A1,B1),NOT(AND(A1,B1))) but it isn't giving me what I expected!

I am trying to use a constant byte (0:255) and am attempting to XOR this byte with the numbers from 0 to 255 to get a resulting value.

number hex value of number XOR result hex value of XOR result

For my constant byte of
231 = 0xE7= 0b11100111
the line for the number 123 should read
123 7B 156 9C
(checked with CALC in Scientific mode!)

How can I implement this, including formatting the second and fourth columns to show hexadecimal values?

Thanks!

John

2. Re: eXclusive ORing (any)

I've found the answer to part of my question.

and using the function =DEC2HEX(A1)

But that was probably the easy part...

John

3. Re: eXclusive ORing (any)

1. To display a number in hex, make sure that the Analysis Toolpak add-in is installed. This makes conversion functions available. The one you need here is DEC2HEX.

With a decimal number in A2, the formula =DEC2HEX(A2,2) will display the hex value with 2 digits (leading 0 if necessary).

2. Tony's formula calculates a Boolean XOR, not a binary XOR. You can create a custom function:

Function BinXor(a, [img]/forums/images/smilies/cool.gif[/img]
BinXor = a Xor b
End Function

and use =BinXor(A2, 231). If you put the function in your Personal.xls, use =Personal.xls!BinXor(A2, 231)

4. Re: eXclusive ORing (any)

That's brilliant, Hans! It works wonderfully.

I had more trouble trying to get Excel 2003 to allow me to run macros than getting the rest to work!

Thanks again.

John

Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•