# How to Format Hex Numbers with a Leading Zero in Excel – 2 Steps

### Step 1 – Convert Decimal Numbers to Hex Format Using the DEC2HEX Function in Excel

• Enter the following formula:
`=DEC2HEX(B5)`

• Drag down the Fill Handle to see the result in the rest of the cells.

### Step 2 -Format Hex Numbers with a Leading Zero Using the Excel RIGHT Function

• The generic formula is:
`RIGHT("Zeros" & cell, string length)`
• In D5, enter the following formula to add a zero before the hexadecimal number:
`=RIGHT("0"&C5, 6)`

• Drag down the Fill Handle to see the result in the rest of the cells.

## Things to Remember

You can use the TEXT function if all numbers are in numeric format, but not with alphabet letters (this method has a limitation in the hexadecimal number system but not in the binary, octal, or decimal number system).

• Enter the following formula:
`=TEXT(C14,"00")`

• Drag down the Fill Handle to see the result in the rest of the cells.

The TEXT function failed to add a leading zero before A, B, C, D, E, F.

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

Get FREE Advanced Excel Exercises with Solutions!
Al Ikram Amit

Al Ikram Amit, holding a BSc in Naval Architecture & Engineering from Bangladesh University of Engineering and Technology, serves as a key Excel & VBA Content Developer at ExcelDemy. Driven by a profound passion for research and innovation, he actively immerses himself in Excel. In his role, Amit not only skillfully addresses complex challenges but also exhibits enthusiasm and expertise in gracefully navigating tough situations, emphasizing his steadfast commitment to consistently delivering exceptional, high-quality content that adds significant... Read Full Bio

We will be happy to hear your thoughts

Advanced Excel Exercises with Solutions PDF