How to Add Leading Zeros to Make 10 Digits in Excel – 10 Methods

The dataset contains Employee Names and their Contact Number. To add leading zeros before the numbers to make 10 digits:

Add Leading Zeros to Make 10 Digits


Method 1 – Using Format Cells to Add Leading Zeros

Steps:

  • Select the contact numbers (C5:C11).
  • Press Ctrl+1 to open the “Format Cells” window.

Use Format Cells to Add Leading Zeros in Excel to Make 10 Digits

  • Select “Custom” and enter “0000000000” in Type.
  • Click OK.

The 10-digit output with leading zeros before the numbers will be displayed.

Use Format Cells to Add Leading Zeros in Excel to Make 10 Digits


Method 2 – Applying Text Format to Insert Leading Zeros

Steps:

  • Select a list of numbers (C5:C11).
  • Change the format to the “Text” in Home.

Apply Text Format to Insert Leading Zeros to Make 10 Digits

  • Enter zeros before the numbers.

  • An “Error” sign will be displayed.
  • Remove it by clicking the “Error” icon and choosing “Ignore Error”.

Apply Text Format to Insert Leading Zeros to Make 10 Digits

This is the output.

Apply Text Format to Insert Leading Zeros to Make 10 Digits

Read More: How to Add Leading Zeros in Excel Text Format


Method 3 – Using the TEXT Function to Add Leading Zeros

Steps:

  • Select a cell to enter the formula. Here, E5.
=TEXT(C5,"0000000000")

The TEXT function converts the number into text format within a string.

Perform TEXT Function to Add Leading Zeros to Construct 10 Digits

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

This is the output.

Perform TEXT Function to Add Leading Zeros to Construct 10 Digits


Method 4 – Adding an Apostrophe Before the Numbers to Add Leading Zeros

Steps:

  • Select C5 and add an apostrophe (‘) before the number adding zeros.

Add Apostrophe Sign Before Numbers to Add Leading Zeros in Excel

See the output with zeros.

  • Repeat this process for all the cells in the table.
  • An “Error” will be displayed.
  • Select all the cells with errors.

Add Apostrophe Sign Before Numbers to Add Leading Zeros in Excel

  • Select the “Error” icon and click “Ignore Error”.

This is the output.

Add Apostrophe Sign Before Numbers to Add Leading Zeros in Excel


Method 5 – Utilizing the RIGHT Function to enter Leading Zeros

Steps:

  • Select a E5 and enter the formula.
=RIGHT("0000000000"&C5,10)

Utilize RIGHT Function to Add Leading Zeros to Make 10 Digits

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

This is the output.

Utilize RIGHT Function to Add Leading Zeros to Make 10 Digits


Method 6 – Adding Leading Zeros with the Excel BASE Function

Steps:

  • Select E5 and enter the formula.
=BASE(C5,10,10)

The BASE function returns a numeric value in text format.

Add Leading Zeros to Make 10 Digits with Excel BASE Function

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

This is the output.

Add Leading Zeros to Make 10 Digits with Excel BASE Function

Read More: How to Put 0 in Excel in Front of Numbers


Method 7 – Using the Power Query PadText Function to Include Leading Zeros

Steps:

  • Open your workbook and go to Data > Get Data > From File > From Text/CSV.

Use Power Query’s PadText Function to Add Leading Zeros in Excel to Make 10 Digits

  • In “Import Data”, select the file.
  • Click “Import”.

  • Data will be imported into your Excel worksheet.
  • Click “Transform data”.

Use Power Query’s PadText Function to Add Leading Zeros in Excel to Make 10 Digits

  • In the “Power Query Editor”, select “Add Column”.
  • Choose “Custom Column”.

Use Power Query’s PadText Function to Add Leading Zeros in Excel to Make 10 Digits

 

  • In the new window, name the column and use the following formula:
=Text.PadStart([Column1],10,"0")
  • Click OK.

Use Power Query’s PadText Function to Add Leading Zeros in Excel to Make 10 Digits

  • The contact number list is displayed with leading zeros.
  • Click“File”.

  • Choose “Close & Load”.

Use Power Query’s PadText Function to Add Leading Zeros in Excel to Make 10 Digits

This is the output.

Use Power Query’s PadText Function to Add Leading Zeros in Excel to Make 10 Digits


Method 8 – Combining the REPT and the LEN Functions to add Leading Zeros

Steps:

  • Select E5 and enter the following formula:
=REPT(0,10-LEN(C5))&C5

The REPT function repeats characters a defined number of times.

The LEN function returns the length of a text string.

Combine REPT and LEN Functions to Add Leading Zeros in Excel

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

This is the output.

Combine REPT and LEN Functions to Add Leading Zeros in Excel


Method 9 Using Excel VBA to Add Leading Zeros

Steps:

  • Select C5:C11 and press Alt+F11 to open the “Microsoft Visual Basic for Applications” window.

Excel VBA to Add Leading Zeros to Make 10 Digits

  • Open a “Module” in “Insert”.

  • Enter the following code and click “Run” .
Sub AddLeadingZeroes()
Range("C5", Range("C5").End(xlDown)).Select
Selection.NumberFormat = "0000000000"
End Sub

Excel VBA to Add Leading Zeros to Make 10 Digits

This is the output.

Excel VBA to Add Leading Zeros to Make 10 Digits


Method 10 – Applying the DAX Formula to Add Leading Zeros

Steps:

  • Select the whole dataset and click “Pivot Table” in “Insert”.

Apply DAX Formula to Add Leading Zeros in Excel to Make 10 Digits

  • Choose a cell to create the pivot table in “Existing Worksheet”.
  • Click OK.

  • In “PivotTable Fields”, place the cursor over “Range” and right-click.
  • Click “Add Measure”.

Apply DAX Formula to Add Leading Zeros in Excel to Make 10 Digits

  • Name the list and enter the formula in “Formula”.
=CONCATENATEX(Range,FORMAT([Contact Number],"0000000000"),",")
  • Click OK.

This is the output.

Apply DAX Formula to Add Leading Zeros in Excel to Make 10 Digits


Things to Remember


Download Practice Workbook

Download the practice workbook.


Related Articles


<< Go Back to Pad Zeros in Excel | Number Format | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Wasim Akram
Wasim Akram

Wasim Akram holds a BSc degree in Industrial and Production Engineering from Ahsanullah University of Science and Technology. Over the past 2 years, he has been actively contributing to the ExcelDemy project, where he has authored more than 150 articles. Now, he is working as an Excel VBA and Content Developer. He likes learning new things about Microsoft Office, especially Excel VBA, Power Query, Data Analysis, and Excel Statistics. He is also very interested in machine learning and... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo