Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Converting to Hexadecimal.

Converting to Hexadecimal

Written by Allen Wyatt (last updated February 15, 2020)
This tip applies to Excel 97, 2000, 2002, and 2003


1

If you do any programming, you know how important hexadecimal numbers are. Hexadecimal numbers are used to represent values that can be easily understood by both humans and programming languages. In the hexadecimal numbering system, each digit can vary between 0 and F. Thus, 0 through 9 are the same as in our decimal numbering system, and A through F are converted to 10 through 15 in decimal.

How can Excel help with hexadecimal numbers? It includes a worksheet function that allows you to easily convert a number from decimal to hexadecimal. For instance, let's say you have a decimal value in E3. If you wanted to know the hexadecimal equivalent, you would use the following:

=DEC2HEX(E3)

If the value in E3 was 123, the result of the above formula would be 7B. The DEC2HEX worksheet function can be used to convert any decimal values between -549,755,813,888 and 549,755,813,887.

Once the conversion is done, the value in the cell is considered text. This means that you cannot use the results of DEC2HEX in a numeric formula.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2308) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Converting to Hexadecimal.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Changing Orientations within a Single Printout

Excel allows you to print out information in either portrait or landscape orientation, but what if you need both types of ...

Discover More

Deleting VBA Code in a Copied Worksheet

VBA makes it easy to copy a worksheet from the current workbook into a brand-new workbook. You may want to delete some ...

Discover More

Entering a Degree Sign

One of the more common symbols that people need to use in their writing is the degree symbol, typically used after a ...

Discover More

Solve Real Business Problems Master business modeling and analysis techniques with Excel and transform data into bottom-line results. This hands-on, scenario-focused guide shows you how to use the latest Excel tools to integrate data from multiple tables. Check out Microsoft Excel 2013 Data Analysis and Business Modeling today!

More ExcelTips (menu)

Iterating Circular References

Does your data require that you perform calculations using circular references? If so, then you'll want to be aware of ...

Discover More

Understanding Functions

The heart of any formula you put together in Excel is worksheet functions. This tip introduces you to worksheet functions ...

Discover More

Numbers in Base 12

Different professions use numbers in entirely unique ways. You may need to come up with a number that represents the ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 7 + 0?

2020-05-05 17:22:36

Erik Renberg

Hello Mr. Wyatt,
I've used many of your excel tips and tricks, a big thank you!

Can you explain why Excel returns the wrong value in the last calculation when I add following calculations to cells:
=HEX2DEC("2000")
=DEC2HEX(8192,4)
=LOG(32,16)
=2+LOG(32,16)
=16^(2+LOG(32,16))
=DEC2HEX(16^(2+LOG(32,16)),4)

The context is I'm taking different color-values of RGB for each base color separately, values ranging from 0 to 255, combining them for a 6-digit RGB hexcode.

Again, thanks for all your usefull tips!
Erik


This Site

Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.