Jump to content


Photo

Entering HEX values in Excel

hexadecimal

  • Please log in to reply
1 reply to this topic

#1 Stewart Armstrong

Stewart Armstrong

    Newbie

  • Members
  • Pip
  • 4 posts

Posted 30 October 2013 - 12:02 PM

I'm trying to enter Hexadecimal values into Excel, but can't figure out how to use them correctly.

 

I can enter something like: 0xABCDEF78

But Excel just recognizes this as text and I can't extract a value from it.  I'm sure it must be possible - can you give me some advice?



#2 Jonathan

Jonathan

    Forums Administrator

  • Administrators
  • 886 posts

Posted 30 October 2013 - 12:13 PM

Hi Stewart,
 
Excel doesn't automatically recognize hexadecimal values, but you can convert hexadecimal numbers into decimal values by using the HEX2DEC function.
For example, the following formula will convert your hex number into a decimal number:
=HEX2DEC("ABCDEF78")
 
You can use the formula palette to find more information about this function and similar functions.  For more on this, see Expert Skills Lesson 3-3 Use the Insert Function dialog and the PMT function.
 
You'll notice that I have removed the 0x part from your hex number, as the HEX2DEC function will not work with a 0x prefix.  You can either strip out the prefixes manually or use the RIGHT and LEN functions to strip them out using the following formula:
=RIGHT(A2,LEN(A2)-2)
 
You can find out more about the RIGHT function, along with the LEFT and MID functions in Expert Skills Lesson 3-20: Extract text from fixed width strings using the LEFT, RIGHT and MID functions.
 
I have created an example spreadsheet showing these formulas in action:
Attached File  Hexadecimal Numbers.xlsx   9.99KB   4701 downloads
hex.png
 
If you need any more help with this, feel free to reply.


Jonathan is part of the professional team who answer Excel-related questions posted on the ExcelCentral.com forums.
Jonathan also tests our courses prior to publication and has worked on all of our ten world bestselling Excel books for Excel 2007, Excel 2010, Excel 2013, Excel 2016 for Windows and Excel 2016 for Apple Mac. Jonathan has also worked on over 850 video lessons for or video courses covering Excel 2007, Excel 2010 and Excel 2013.
As well as extensive Excel knowledge, Jonathan has worked in the IT world for over thirteen years as a programmer, database designer and analyst for some of the world's largest companies.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users