Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

How To Add or Pad Leading Zeros To Numbers or text In Excel?

If you have a list of numbers that you need to add or pad some leading zeros before the numbers, when typing the zeros manually, they will be removed by default. This article is going to show you some tutorials about how to add leading zeros to numbers or text in ranges of cells in Excel.

doc add leading zeros 1

Method 1: Add or pad the leading zeros to numbers to equal certain length with Text function

Method 2: Add or pad the leading zeros to numbers to equal certain length with Format Cells function

Method 3: Add or insert the same number of leading zeros to numbers with Concatenate function

Method 4: Add or insert the same number of leading zeros to numbers and text with Kutools for Excel


Add or insert leading zeros to numbers or text strings in Excel:

With Kutools for Excel's Add Text feature, you can quickly add specific text before, after or certain position for a list of cell data as you need.

doc add leading zeros 8

Download and free trial 60-day

 

Method 1: Add or pad the leading zeros to numbers to equal certain length with Text function


Supposing you have a range of data, and you need to add zeros in front of each cells to make the numbers as same length. How could you quickly add the zeros before the numbers?

The Text function will add zeros in front of numbers, and make the new numbers with leading zeros in certain length.

Enter the formula =TEXT(A4,"000000") in a blank cell where you want to output the result, and then drag the fill handle down to the cells that you want to apply this formula, and all the numbers become a fixed six-digit character string, see screenshot:

doc add leading zeros 2

Note: This Text function can not add leading zeros for text.


Method 2: Add or pad the leading zeros to numbers to equal certain length with Format Cells function

In Excel, the Format Cells feature also can help you pad the leading zeros to cell values to make them as same length, please do as this:

1. Select the cell values you want to pad leading zeros, and then right click, then choose Format Cells from the context menu.

2. In the Format Cells dialog box, under the Number tab, select Custom in the left Category pane, and then enter 000000 into the Type text box, (In this example, I will make the numbers as six-digit numbers, you can change it to your need.), see screenshot:

doc add leading zeros 3

3. Then, click OK to close this dialog box, and the numbers in the original cells have been converted to the certain length numbers with leading zeros. See screenshot:

doc add leading zeros 4


Method 3: Add or insert the same number of leading zeros to numbers with Concatenate function

If you want to insert specific digit of leading zeros into each number, for example three leading zeros for each number, you should try the Concatenate function.

Enter the formula =CONCATENATE("000",A4) in a blank cell, and then drag the fill handle down to fill this formula to other cells, and all numbers have been added three zeros before the numbers, see screenshot:

doc add leading zeros 5


Method 4: Method 4: Add or insert the same number of leading zeros to numbers and text with Kutools for Excel

Functions or formulas may be not easy for you to remember and apply. Here is another tricky way, the Add Text utility of Kutools for Excel, to help you insert leading zeros before numbers in selections.

Kutools for Excel : with more than 300 handy Excel add-ins, free to try with no limitation in 60 days. 

1. Select the range that you want to add zeros before the numbers or text.

2. Then click Kutools > Text > Add Text, see screenshot:

doc add leading zeros 6

3. In the Add Text dialog box, enter the number of zeros with a leading apostrophe in the Text box, and select the Before first character option, then click Ok button, and the zeros have been added before the numbers as following screenshot shown:

doc add leading zeros 7

Click to Download Kutools for Excel and free trial Now!

The Add Text utility of Kutools for Excel supports us to add any specific text and characters before or after the original cell text. What's more, we can add specific text between original cell texts. No matter which settings you set, you can preview the cell changes in the Preview section. Click to know more about this utility.


Add leading zeros to numbers or text with Kutools for Excel

Kutools for Excel includes more than 300 handy Excel tools. Free to try with no limitation in 60 days. Download the free trial now!


Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%

  • Reuse: Quickly insert complex formulas, charts and anything that you have used before; Encrypt Cells with password; Create Mailing List and send emails...
  • Super Formula Bar (easily edit multiple lines of text and formula); Reading Layout (easily read and edit large numbers of cells); Paste to Filtered Range...
  • Merge Cells/Rows/Columns without losing Data; Split Cells Content; Combine Duplicate Rows/Columns... Prevent Duplicate Cells; Compare Ranges...
  • Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find and Fuzzy Find in Many Workbooks; Random Select...
  • Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more...
  • Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments...
  • Super Filter (save and apply filter schemes to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic...
  • Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF...
  • More than 300 powerful features. Supports Office/Excel 2007-2019 and 365. Supports all languages. Easy deploying in your enterprise or organization. Full features 30-day free trial.
kte tab 201905

Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
officetab bottom
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    superstar · 11 months ago
    В примере ошибка, нужно ставить не запятую, а точку с запятой: "= Текст (A2, "00000")"
  • To post as a guest, your comment is unpublished.
    Narcisse · 11 months ago
    thank you, very helpful
  • To post as a guest, your comment is unpublished.
    Bernice · 1 years ago
    I was wondering how i would write phone numbers in excel, but there was no zeros appearing. And also the phone numbers are in one column like

    column D
  • To post as a guest, your comment is unpublished.
    Rashida · 1 years ago
    Thank you for sharing..it's really use for me.
  • To post as a guest, your comment is unpublished.
    Shirley · 1 years ago
    Thank you for helping me out. You saved my day!
  • To post as a guest, your comment is unpublished.
    Peter · 2 years ago
    Worked well for me. Thanks alot.
  • To post as a guest, your comment is unpublished.
    Ryan · 2 years ago
    Hey, i was wondering how to put text in-front of a number with 0 decimal places.
    ie. it comes up as " Sp3.145255246345 " and i want it to show " Sp3"


    Thanks
  • To post as a guest, your comment is unpublished.
    MANMOHAN · 2 years ago
    Use 0&
    example: =0&0&A1 (A1 is cell in which 00 is to be added as prefix)
  • To post as a guest, your comment is unpublished.
    Andrea · 2 years ago
    I need to add zeros to the front of the ID (know how to add leading zeros) but some need 6 and some need 5 zeros. Is there a formula to make sure I have a 10 digit number when I'm done?
    • To post as a guest, your comment is unpublished.
      jyoti · 1 years ago
      you can use "REP FUNCTION AND LENGTH FUNCTION TOGETHER " for such problems.

      Example : =REP(0,10-LEN(C4))&C4
    • To post as a guest, your comment is unpublished.
      Blake · 2 years ago
      Hi Andrea. Assuming your original text is in cell A2, you can type =TEXT(A2,"0000000000")

      That will ensure that there are enough leading zeros so that you have 10 characters in each string.
  • To post as a guest, your comment is unpublished.
    Gaz · 2 years ago
    CMD & BLAKE, You are absolute whizzkids! :-)
    thanks
  • To post as a guest, your comment is unpublished.
    Duane · 2 years ago
    I deal alot with serial numbers of my companies product that includes leading zeros, which I frequently store in Excel sheets by pasting them out of our SAP system. Usually I can just format the cells as text before pasting them, which keeps the zeros, but occasionally I have to add them back in. Before finding this article I've struggled with that, but this works perfectly, thanks for the tip.
  • To post as a guest, your comment is unpublished.
    Sharon · 2 years ago
    Hi! I have no idea if this is possible or not, but my boss would like to enter whole numbers into cells, but then have them converted into decimals (for example, he want to enter a 5 in the cell, but then have it converted to .0005). Another example that he gave is he might enter 49 and would like the cell to be .0049. Any suggestions/ideas? Thanks!
    • To post as a guest, your comment is unpublished.
      Peter · 2 years ago
      A1=5
      B1 = A1/10000
      = .0005
    • To post as a guest, your comment is unpublished.
      Blake · 2 years ago
      Hi. You could enter a formula that divides the cell by 10000. For example, if your entry cell is A1 and your cell for formatting is B1, you can type the following in B1:

      =A1/10000

      Then type something in A1 and check. Does that work or do you need a more precise solution?
  • To post as a guest, your comment is unpublished.
    scott.george@siemens · 2 years ago
    Adding leading zeros
  • To post as a guest, your comment is unpublished.
    Anup · 3 years ago
    Hello

    I want to add "00" for A1 column but every cell contain random numeric digits.

    Thanks in advance.
  • To post as a guest, your comment is unpublished.
    Hayley · 3 years ago
    Hi, I have a problem, but not sure if it can be fixed in Excel:

    I have to export a file to CSV (currently the only option), within that file there are numbers that are usually 16 characters long, the first 2 are zeros, and sometimes, the last two figures might be E followed by a number, for example, 00633597038029E6. In the system they are being exported from, it is consistent and there isn't a problem, however as soon as the CSV file is opened in Excel, it converts the E6 and replaces it with 6 zeros, the above number becomes 00633597038029000000. However, it also only does this when it drops the 2 zeros from the front. Leaving it as 633597038029000000. When excel does not decide to drop the 2 zeros, it isn't a problem and it leaves the number as E6, it is only on the occasion where it has for some reason, dropped the 2 zeros.

    The problem I have is that it seems that by the time I have opened the file, it is too late to do anything as excel has already converted the numbers.

    Is there anything that can be done about this?
  • To post as a guest, your comment is unpublished.
    Johncy · 3 years ago
    How to convert a number into thousands or lakhs, depending on the number of zeroes required.
    Is it possible through formatting.
  • To post as a guest, your comment is unpublished.
    Gin · 3 years ago
    Hi all,

    I have dates in the format yyymmdd, e.g. 2080201 stays for 1st of Feb. 2008 (2008.02.01). how can I add a zero after the first two digits?

    like: yyymmdd to yyyymmdd (e.g. 2080201 to 20080201)

    Thanks!
  • To post as a guest, your comment is unpublished.
    Twowolves · 3 years ago
    Nice! Just ran into this problem at work and was amazed at how easy the solution was! Thanks!
  • To post as a guest, your comment is unpublished.
    kate · 3 years ago
    thanks for the info !
  • To post as a guest, your comment is unpublished.
    Zella · 3 years ago
    Great tips! I need to make this number 1-354-0-2 be in the following format: 01-0354-00-02. Can you help??
    Thanks!
  • To post as a guest, your comment is unpublished.
    Smithc530 · 3 years ago
    I am no longer sure the place you're getting your info, but great topic. I needs to spend a while studying much more or understanding more. Thanks for wonderful info I was on the lookout for this info for my mission. efbdcekddgfegdfe
  • To post as a guest, your comment is unpublished.
    oc · 3 years ago
    Thank you Blake...works perfec.
  • To post as a guest, your comment is unpublished.
    Blake · 3 years ago
    #OC, I wrote you a VBA script. To execute, open your subject Workbook, ensure that the affected column is formatted as Text, then press alt+F11, then in the toolbar select Insert > Module. When the editor loads, paste the following code in and then execute:

    Sub Column_Fix()

    Dim rng As Range, col As Range, arr
    Dim sht As Worksheet, c As Range, tmp

    On Error Resume Next 'in case of cancellation
    Set rng = Application.InputBox( _
    Prompt:="Please select the column that contains the incorrect values." & _
    " (e.g. Column A or Column B)", _
    Title:="Select Range", Type:=8)

    On Error GoTo 0


    hdr = MsgBox("Does your selection contain a header?", vbYesNo + vbQuestion, "Header Option")

    If rng Is Nothing Then Exit Sub

    If rng.Columns.Count > 1 Then
    MsgBox "Please select only one column at a time.", vbExclamation
    Exit Sub
    End If

    Set sht = rng.Parent


    Application.ScreenUpdating = False
    If hdr = vbYes Then
    Set col = sht.Range(sht.Cells(2, rng.Column), _
    sht.Cells(sht.Rows.Count, rng.Column).End(xlUp))

    For Each c In col.Cells
    c.Value = Replace(c.Value, ".", "")
    Next c
    End If
    If hdr = vbNo Then
    Set col = sht.Range(sht.Cells(1, rng.Column), _
    sht.Cells(sht.Rows.Count, rng.Column).End(xlUp))

    For Each c In col.Cells
    c.Value = Replace(c.Value, ".", "")
    Next c
    End If
    Application.ScreenUpdating = True
    End Sub



    If you have any problems, let me know.
    • To post as a guest, your comment is unpublished.
      oc · 3 years ago
      Thank you! Works like a charm..
  • To post as a guest, your comment is unpublished.
    oc · 3 years ago
    HOW CAN I HAVE A VALUE OF 0.0010 SHOW AS 00010 AND A VALUE OF 1.001 AS 1001? IN EXCEL? Thanks.
  • To post as a guest, your comment is unpublished.
    HARI · 3 years ago
    thx a lot. I like to learn a lot
  • To post as a guest, your comment is unpublished.
    Tanvir · 4 years ago
    tanx boss, really so nice
  • To post as a guest, your comment is unpublished.
    Afra · 4 years ago
    how to 8.00 ?? please ans
  • To post as a guest, your comment is unpublished.
    Brandon · 4 years ago
    Thanks for sharing the information, example well formatted, baie dankie :)
  • To post as a guest, your comment is unpublished.
    Lizz · 4 years ago
    Thank you for all your helpful tips. I was wondering if there is a way to format the answers from a formula to be able to copy the result into another program as a number.
    Ex. I need to use the number produced from =Text (A1, "000")
    Cell A1 12345
    Cell A2 =Text (A1,"000000")Result being 012345
    Copy & Paste 012345 as a number into another program without the formula being pasted into the other program.
    When I copy & paste 012345 the result is =Text (A1, "000000")
    • To post as a guest, your comment is unpublished.
      cmd · 4 years ago
      Try Paste Special > Values and number formats
  • To post as a guest, your comment is unpublished.
    vartaxe · 4 years ago
    how to do when cells look like this:

    ABW-M-1
    BAS-B-74
    ESU-F-3

    and need them to be:

    ABW-M-001
    BAS-B-074
    ESU-F-003

    ? :/
    • To post as a guest, your comment is unpublished.
      cmd · 4 years ago
      1) Use Text to Columns (Data > Text to Columns) to split out the last number. - Use fixed width and split after the second hyphen/dash.
      2) Use =Text(B1,"000") formula for the numbers you need changed to 3 digits.
      3) Use Concatenate formula to recombine the data back into a single string.


      1. Split with Text to Column
      2. Insert formula =Text(B1,"000") (Column C)
      3. Concatenate Column A & Column C (Column D)

      A B C D
      ABW-M- 1 001 ABW-M-001
      BAS-B- 74 074 BAS-B-074
      ESU-F- 3 003 ESU-F-003
  • To post as a guest, your comment is unpublished.
    Jamie · 4 years ago
    Absolutely perfect, the =Text (A1, "00000") Formula works perfectly for me! Excel can do some incredible things, its just knowing these formulas!!
  • To post as a guest, your comment is unpublished.
    Ruby · 5 years ago
    for you because you are the best
  • To post as a guest, your comment is unpublished.
    Delio · 5 years ago
    does not work i used the exact numbers and i receive formula error

    =text(B4,"00000") from A1 being 2932
  • To post as a guest, your comment is unpublished.
    Matt_m · 5 years ago
    Is there anyway to ad quotation marks before and after any text entered into a cell? It looks like Kutools could do it but is there anyway to do it with just Excel? Thanks in advance.
    • To post as a guest, your comment is unpublished.
      cmd · 5 years ago
      Here is a quick way to add the quotation mark before & after your text...

      1. Enter " into a blank cell.
      2. Formula... =(select cell with the ")&(select cell with your text)&(select cell with the ")
      Example: " in cell A1 and Barry in cell C1... =A1&C1&A1.
      Result: "Barry"
  • To post as a guest, your comment is unpublished.
    mutale kay · 5 years ago
    very good topic, i have got my work done.
  • To post as a guest, your comment is unpublished.
    seema sahu · 5 years ago
    thnx my prob is solved.
  • To post as a guest, your comment is unpublished.
    Marlene · 5 years ago
    Thanks a lot! It saved me !
  • To post as a guest, your comment is unpublished.
    Firat · 5 years ago
    Great tips! Text function just saved my day, thank you for this simple solution.
  • To post as a guest, your comment is unpublished.
    ANSELM · 5 years ago
    THIS IS JUST AWESOME. MANY THANKS.
    PLEASE I STILL HAVE ONE CHALLENGE ON THIS, I HAVE A RANGE TO WORK ON, FIRST I HAVE TO ROUND THE NUMBERS UP TO 10, BUT I HAVE THEM IN 3 DIFFERENT DIGITS (6, 7 & 8) SCATTERED ALL OVER THE RANGE. MY PROBLEM IS HOW TO INPUT A FOMULAR THAT WILL ENABLE THE EXCEL DETECT HOW MANY ZEROS EACH OF THE NUMBERS WILL HAVE IN FRONT TO ROUND UP TO 10.
  • To post as a guest, your comment is unpublished.
    Hafiz Mohammad Yasee · 5 years ago
    thanks I found my problem from your site.
  • To post as a guest, your comment is unpublished.
    wani · 5 years ago
    [b]cmd[/b], you are very helpful. thanks!!
  • To post as a guest, your comment is unpublished.
    Jen · 5 years ago
    What if there are dashes, for example 3-14-50-12, 10-12-48-6. But you only need there to be a 0 in front of the single digit at the beginning?
  • To post as a guest, your comment is unpublished.
    C · 5 years ago
    Instructions on how to add leading zeros.
  • To post as a guest, your comment is unpublished.
    cmd · 5 years ago
    First off this has been a very helpful site. Thanks!

    One tip for those like me who are trying to add leading zeros & leading text, try using the "&" to pull everything together.

    Example:
    ="Bob"&(Text(value,"000000")). If the value (number) is 123, the result will be... Bob000123
    • To post as a guest, your comment is unpublished.
      Melissa · 4 years ago
      Thanks for this tip CMD, this is exactly what I was trying to do!!
    • To post as a guest, your comment is unpublished.
      Ms. R Kumar · 5 years ago
      Thanks a lot for the help given using Excel.
  • To post as a guest, your comment is unpublished.
    Subhendu Baliarsingh · 5 years ago
    Thanks....its very very helped me
  • To post as a guest, your comment is unpublished.
    Pam · 5 years ago
    Still not working - I have a alphanumeric number A1234 that I need to put a zero in front of the A how do you do that?
  • To post as a guest, your comment is unpublished.
    Daniella Kane · 5 years ago
    Thia was AWESOME!!! Thanks!!!!
  • To post as a guest, your comment is unpublished.
    Patrick · 5 years ago
    Excellent fix. Thanks
  • To post as a guest, your comment is unpublished.
    peter · 5 years ago
    I have used concatenate to create two leading zeros in number not text. A1 00 B1 00 C1 1234 = 001234
    my problem is the worksheet needs to be uploaded into a program and the C1 cell is a problem because it has the concatenate formula and is not recognised as a number. Can you help?
    • To post as a guest, your comment is unpublished.
      Blake · 5 years ago
      Simple fix. After using the aforementinoed formula, copy all cells that contain formulas and right click and 'paste values'. This will keep the values on the spreadsheet (formula results) and get rid of the formulas for you.
      • To post as a guest, your comment is unpublished.
        peter · 5 years ago
        Thanks, I did try that however when pasted as values the result goes to text and not a number. Any ideas appreciated
  • To post as a guest, your comment is unpublished.
    Pam · 5 years ago
    Ok so what if your field has A1234 and you want to add a 0 in front of the A how do you do that?