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)

Convert Decimal Numbers to Hex Format Using DEC2HEX Function in Excel

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

dragging the fill handle down


 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)

Format Hex Numbers with Leading Zero Using Excel RIGHT Function

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

 

again we will drag the fill handle down to add a leading zero


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")

Utilize the TEXT function

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

drag the fill handle down to copy the formula for the rest of the cells

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

the Text Function has failed to add a leading zero before A, B, C, D, E, F


Download Practice Workbook

Download the practice workbook.


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

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

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo