How to Convert Decimal Number to Hexadecimal (Hex) in Excel

The article will focus on some key aspects of how to convert decimal numbers to hexadecimal format (hex) in Excel. There are many technical applications of hexadecimal numbers such as Assembly and Machine language. Programmers frequently use this number format to insert memory addresses. It can also be used to represent numbers kept in a CPU’s registers or in main memory as well as during the debugging phase of programming. It has a large application in data processing. So a computer or software engineer can effectively use Excel to convert decimal numbers to hexadecimal. The process of this conversion is very easy and time-saving.


How to Convert Decimal Number to Hexadecimal (Hex) in Excel: 2 Practical Ways

In the dataset, we have some positive and negative decimals. We will convert them to hexadecimal in the following sections.

excel decimal to hex


1. Using Excel DEC2HEX Function to Convert Decimal to Hex (Hexadecimal)

Excel has a built-in function to convert a decimal number to its hexadecimal format. The name of this function is DEC2HEX. Let’s have a look at it’s application.

Steps:

  • First, make a column to store the hexadecimal numbers and type the following formula in its first cell.

=DEC2HEX(B5)

Using Excel DEC2HEX Function to Convert Decimal to Hex (Hexadecimal)

  • After that, press the ENTER.

  • Next, use the Fill Handle to AutoFill the lower cells.

Thus you can convert any decimal number to hexadecimal format (hex) using Excel DEC2HEX function.


2. Converting Decimal to Hexadecimal with Colon

In some databases, the digits of a hexadecimal number need to be separated by colon symbols when the numbers are very large. To understand the procedure, please have a glance at the following description.

Steps:

  • First, make a column to store the hexadecimal numbers and type the following formula in cell C5.

=IF(MOD(LEN(DEC2HEX(B5)),2)=1,"0"&MID(DEC2HEX(B5),1,1)&":"&MID(DEC2HEX(B5),2,2)&":"&MID(DEC2HEX(B5),4,2)&":"&MID(DEC2HEX(B5),6,2)&":"&MID(DEC2HEX(B5),8,2),MID(DEC2HEX(B5),1,2)&":"&MID(DEC2HEX(B5),3,2)&":"&MID(DEC2HEX(B5),5,2)&":"&MID(DEC2HEX(B5),7,2)&":"&MID(DEC2HEX(B5),9,2))

Converting Decimal to Hexadecimal with Colon

The formula uses various functions like IF, MOD, LEN, MID and DEC2HEX to complete the operation. These functions (except DEC2HEX) help to insert colons inside the hexadecimal number.

  • After that, press the ENTER button and you will see the decimal number in B5 converted to a hexadecimal number.

excel decimal to hex method 2

  • Thereafter, drag the Fill icon to AutoFill the lower cells.

Thus you can get all the large decimal numbers as hexadecimal numbers (hex) with colons.


How to Convert Decimal Number to Other Number Formats

We can convert the decimals not only to the hexadecimal format but also to other formats like binary and octal. For that purpose, we use similar formulas with the DEC2BIN and DEC2OCT functions. Let’s follow the instructions below for a detailed overview. The DEC2BIN and DEC2OCT functions convert a decimal number to its binary and octal format.

Steps:

  • First, store your decimal numbers in a column and type the following formula to convert them to binary

=DEC2BIN(B5)

excel decimal to hex

  • Next, use the Fill Handle to AutoFill the lower cells.

Thus you can convert your decimal data to binary format.

  • Now, if you wish to convert the numbers to octal format, just use the formula given below.

=DEC2OCT(B5)

  • After that, fill the lower cells using the Fill Handle.

Thus you can convert a decimal number to other number formats such as binary and octal.


Things to Remember

  • For the DEC2HEX function, the range of numbers that can be converted is [-2^39, 2^39 – 1] or [-549,755,813,888, 549,755,813,887]. If we insert any decimal number out of this range, the formula will return the Number (#NUM!)
  • Similarly, the applicable number range for DEC2BIN and DEC2OCT functions are [-512,511] and [-536,870,912, 536,870,911]

Practice Section

Here, I’m giving you the dataset of this article so that you can practice these methods on your own and gain expertise.


Download Practice Workbook


Conclusion

In the end, we can conclude that the article will provide you some useful idea to convert a decimal number to its hexadecimal (hex) format. If you have any better suggestions or questions or feedback regarding this article, please share them in the comment box. This will help me enrich my upcoming articles.


<< Go Back to | Excel Number System Conversion | Excel for Math | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Meraz Al Nahian
Meraz Al Nahian

Md. Meraz Al Nahian has worked with the ExcelDemy project for over 1.5 years. He wrote 140+ articles for ExcelDemy. He also solved a lot of user problems and worked on dashboards. He is interested in data analysis, advanced Excel, statistics, and dashboards. He also likes to explore various Excel and VBA applications. He completed his graduation in Electrical & Electronic Engineering from Bangladesh University of Engineering & Technology (BUET). He enjoys exploring Excel-related features to gain efficiency... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo