Closed Thread
Results 1 to 8 of 8

Entering HEX into Excel

  1. #1
    Registered User
    Join Date
    03-30-2008
    Posts
    2

    Entering HEX into Excel

    I was assuming it was obivous how into enter hexidecimal numbers into Excel but I think I've failed.

    I've tried:

    0x
    &
    HEX(...)

    Am I missing something obivous? Is there a hex option?

    Thanks,

  2. #2
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    Well, I think entering them should be easy enough.....do you mean that you want excel to interpret them as HEX numbers? What do you want to do with them, how high do they go?

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Excel doesn't handle hex numbers. If can convert between decimal numbers and hex strings, but the hex strings are just that: strings. You can't, for example, format a number as hex (though it would be convenient).

    You can format a cell as text (that's important, in case all the digits are 0-9), enter a hex string, and then use HEX2DEC() to convert it to a decimal number.

    It's (slightly) analagous to how Excel represents complex numbers; what you see (the string) is what is stored, and only functions that expect such string representations (the functions that handle complex numbers) can use it.

    VBA can use hex strings for integer (Byte, Integer, Long) constants: someLong = &HABCD.

  4. #4
    Registered User
    Join Date
    03-30-2008
    Posts
    2

    Entering HEX into Excel

    Thanks for the help!!!

    Strange that Excel can't handle intrepreting numbers that are 0x<format>. I do Embedded Systems so most of the data is in Hex.

    The:

    HEX2DEC(number) routine

    Would have been really useful if I could put a cell rather than a number.

    Any ideas?

  5. #5
    Registered User
    Join Date
    08-17-2004
    Posts
    14
    You should be able to put a cell in. Ie =HEX2DEC(A2)

    Need to make sure you don't have the trailing x on the hex number though.

    Would have to be "0A4" instead of "0A4x" in cell A2

    Good Luck

  6. #6
    Registered User
    Join Date
    01-30-2013
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Entering HEX into Excel

    Quote Originally Posted by JRock View Post
    You should be able to put a cell in. Ie =HEX2DEC(A2)

    Need to make sure you don't have the trailing x on the hex number though.

    Would have to be "0A4" instead of "0A4x" in cell A2

    Good Luck
    I have just encountered the same problem. How to fix this?
    Suppose you have values in the form of
    0xDEADBEEF
    0x10011001

    etc in column A after importing the output of the other program
    Then edit cell B1 and enter =HEX2DEC(RIGHT(A1;LEN(A1)-2))
    The actual value is now in B1
    Extend this to the other values by double-clicking the small dot on the bottom right of the cell.
    0xDEADBEEF 3735928559
    0x10011001 268505089

  7. #7
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Entering HEX into Excel

    Mike welcome to the forum.

    This is an(almost) 5 years old thread. As per forum rules, you have to start your own thrad and if you like to provide a link to this one.
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  8. #8
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,576

    Re: Entering HEX into Excel

    Correct. I will close this one.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1