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.

by Allen Wyatt
(last updated November 20, 2017)

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

Automatic Lines for Dividing Lists

When preparing a report for others to use, it is not unusual to add a horizontal line between major sections of the ...

Discover More

Unable to Set Margins in a Document

If you find that you cannot set the margins in a document, chances are good that it is due to document corruption. Here's ...

Discover More

Inserting Page Number Cross-References

Want to insert a dynamic cross-reference to a particular page number? It's easy to do following the steps in this tip.

Discover More

Professional Development Guidance! Four world-class developers offer start-to-finish guidance for building powerful, robust, and secure applications with Excel. The authors show how to consistently make the right design decisions and make the most of Excel's powerful features. Check out Professional Excel Development today!

Understanding Functions

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

Discover More

Counting Unique Values with Functions

Using Excel to maintain lists of information is not unusual. When working with the list you may need to determine how ...

Discover More

Returning a Blank Value

Is it possible for a formula to return a blank value? It depends on how you define your terms. This tip examines all the ...

Discover More
##### Subscribe

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

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}] 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 2 + 9?

2018-05-06 12:10:25

Max R Barker

Thanks for the tip but my Excel 97 doesn't have the DEC2HEX Function. Max

2017-08-13 18:06:03

.

Thank you!

2017-01-04 14:37:46

The converting hex values to rgb colors can be done with userform using Dec2Hex and macro codes.

The template can be viewed here :https://www.youtube.com/watch?v=YZZeBU4rH8w

2014-08-28 19:02:20

Andrew Burton

This is a great tutorial, it neglects one important thing:

If DEC2HEX is not available, you will have to install an add-in pack:

- Click "Tools" on the drop-down menu
- Select the checkbox beside "Analysis Toolpack"
- You will now be prompted for the Microsoft Office installer disc.
- Insert the disc and click "Ok"
- DEC2HEX (and other functions) will now be available.

NB: This was for Excel 2000. Other versions may have a slightly different installation procedure.

2014-08-25 14:24:36

Eric Richards

While this is a great tutorial, and a easy to remember function.

You can also use the BASE function, for example

=BASE(255;16;4) will give you 00FF
=BASE(255;8;4) will give you Octal 0377

However I have not tested to see if the Hexadecimal result is considered as text.

##### 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.

##### Subscribe

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