Results 1 to 4 of 4
  1. #1
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    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.

    The column headings are
    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
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  2. #2
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: eXclusive ORing (any)

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

    Displaying hexadecimal values requires the installation of the Analysis ToolPak Add-In
    and using the function =DEC2HEX(A1)

    But that was probably the easy part...

    John
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    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. #4
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    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
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

Posting Permissions

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