• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Excel Tutorials by Y. Acosta

Excel Tutorials + Tips

  • Excel Tutorials
  • Etsy Store
  • Other Resources
  • About Me
    • About Me
    • Contact Me
    • FREE Printable List of Top Excel Keyboard Shortcuts
  • FREE pdf of Top Excel Shortcuts!

Top Ways to Add a Zero in Front of a Number in Excel (+ video tutorial)

❤ Support Free Excel Training by Sharing -

We may be compensated for your purchase of any of the products featured on this page – it helps us keep the lights on :)

Sometimes referred to as “leading zeros,” it can be surprisingly tricky to add a zero in front of a number in Excel.

Consider a set of numbers in Excel where you want them all to be the same number of characters but they’re not, so you need to add a zero in front of them. You type a zero in the front, but then it disappears! GRRRRRR!!!!  

Excel automatically removes the zeros from the beginning of numbers because no numbers naturally begin with zero. So we have to get a little creative.

Table Of Contents
  1. 1.      Use an Apostrophe to Add a Zero in Front
  2. 2.      Use the REPT Function to Add Leading Zeros
  3. 3.      Apply Custom Formatting to Add Leading Zeros
  4. 4.     BONUS TIP: Keep Zeros in Front by Updating the Leading Zeros Settings (still in beta)

3 Ways to Add a Zero in Front of a Number in Excel (+ a bonus way!)

Watch the tutorial: How to Add a Zero in Front of a Number in Excel

1.      Use an Apostrophe to Add a Zero in Front

If you only need to add zeros in front of a few numbers, beginning the cell contents with an apostrophe (‘) is the easiest way to go.

Using an apostrophe at the beginning of a cell automatically converts its contents to text formatting, allowing you to add as many zeros, or other characters, in front of the numbers as you want.

This is done one cell at a time so it can be time-consuming; I don’t recommend it if you need to add zeros to a range of cells.

Use an Apostrophe to Add a Zero in Front of a Number in Excel
Use an Apostrophe to Add a Zero in Front of a Number in Excel

Keep in Mind…

Because this converts the cell contents to text formatting, Excel will flag these as an error. Specifically, a “Number Stored as Text” error.

You’ll see this flagged with a tiny, green triangle at the top-left corner of each cell formatted this way.

If you need to use the values in these cells for any calculations, this method may not be for you as it could lead to calculation errors. If so, you should leave your cells formatted as numbers and use the third method below.

If you simply want to hide the green triangle, select all the cells with the error and click “Ignore Error.”

2.      Use the REPT Function to Add Leading Zeros

The second way you can add zeros in front of numbers in Excel is by using the Repeat or REPT function.

REPT works by repeating whatever character you want a certain number of times.

The REPT function needs 2 items:

  1. the text you want to be repeated and
  2. the number of times it should be repeated

So you can use a 0 as the text to repeat, followed by the number of times you would like it to appear.

For example, to create a list where all cells begin with two zeros, you can use REPT to combine the number of zeros you need with the contents of the cells.

It would look something like this:

=REPT(0,2)&A2

Here, we are repeating 0 two times and using the “&” to join the result with the contents of cell A2.

Then, if you like, you can replace the original values with the formula results – pasting them as values so that you do not undo the new formatting.

Use the REPT Function to Add Leading Zeros in Excel
Use the REPT Function to Add Leading Zeros in Excel

Keep in Mind…

If you want for all your cells to contain the same number of characters, you have to be careful when using REPT and copying it down to other cells.

REPT is ideal if all the cells you are starting with contain the same number of characters.

If they do not, adding the same number of zeros to all will not result in a uniform list.

To get around this, you can use an IF function along with REPT. For example, you could try something like:

=IF((LEN(A2)<6),REPT(0,6-LEN(A2))&A2,A2)

3.      Apply Custom Formatting to Add Leading Zeros

The third way you can add zeros in front of a number in Excel is by using custom formatting. You can format the cells to display a set quantity of zeros in front.

Let’s say you want to format your cells to display 6 numbers. To do this:

  1. Select all the cells you need to add a zero to, right-click and select Format Cells
  2. In the Number tab, select Custom
  3. Under Type, enter 6 zeros
  4. Click OK
Apply Custom Formatting to Format Cells with Leading Zeros
Apply Custom Formatting to Format Cells with Leading Zeros

With this special formatting, Excel will force the cells to display at least 6 numbers. If a cell contains less than 6 numbers, Excel will correct itself by inserting the necessary number of zeros at the beginning of the cell.

4.     BONUS TIP: Keep Zeros in Front by Updating the Leading Zeros Settings (still in beta)

If you subscribe to Office 365, you likely have access to some betas.

Excel is, as of the time I’m writing this update in November 2022, beta testing a setting that lets you easily add zeros in front of other numbers (i.e., Leading Zeros) simply by unchecking a box.

WATCH: Excel Leading Zeros Setting (Beta) – Video Tutorial

NOTE: Being that this is a beta, there is, of course, no guarantee that it will be rolled out. Just something to keep in mind.

You can check if you have the Leading Zeros setting by going to your Excel Options. Here, you can also activate it.

Activate the Leading Zeros setting by:

  1. Going to your Excel File menu
  2. Click on Options
  3. In Excel Options, click on AdvancedLook for the section labeled “Automatic Data Conversion (BETA)”
  4. Uncheck the box labeled “Remove leading zeros and convert to a number”
  5. Click OK
blank
Leading Zeros Settings Beta in Excel Options

NOTE: This setting will convert the contents of cells with zeros in front to Text formatting.



FYI, this was created using the desktop version of Excel in Microsoft 365.

Related Articles:

  • Leading Zeros Beta in Excel (featured image)
    Excel Leading Zeros Setting (Beta) – with…
  • Hard Code Phone Numbers in Excel (featured image)
    Can You Really Hard-Code Phone Numbers in…
  • Phone Number Formatting in Excel - Tutorial Feat. Image
    How to Format Phone Numbers in Excel (with…

❤ Support Free Excel Training by Sharing -

blank

About Y. Acosta

Yil's (pronounced like "Jill") passion for Excel spreadsheets can be traced back to her days in marketing, where she spent significant time working on analytics. As a content creator, she now specializes in Excel spreadsheet tutorials. Make sure to visit the About page to learn more.

Reader Interactions

Comments

  1. blankPerry Johnson says

    at

    Thanks,
    I normaly convert to text. Text(a2, “00000”). Usually for something like zip codes.

    Reply
    • blankY. Acosta says

      at

      Hi, Perry. Thanks so much for your feedback! Another thing you can do for zip codes is to use custom zip code formatting. Once you’re in the Format Cells options, you’ll find this under the “Special” category.

      Reply
  2. blankPopescu Laurentiu says

    at

    top notch explication. thank you

    Reply
    • blankY. Acosta says

      at

      Thank you so much!!! 🙂

      Reply
  3. blankAlexander says

    at

    Thank you, this was helpful.

    Reply
    • blankY. Acosta says

      at

      Thanks, Alexander! I’m really glad this helped you 🙂

      Reply
  4. blankCollins Lawrence says

    at

    This is the best solution to the problem

    Reply
    • blankY. Acosta says

      at

      Thanks so much!

      Reply
  5. blankVENACE VICENT says

    at

    Awesome, I found this reading so useful in my career.

    Reply
    • blankY. Acosta says

      at

      That’s excellent! So excited for you. Thanks so much for sharing.

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Follow us:

Latest Tutorial:

Featured image for How to Use Find & Replace to Remove Wildcard Characters in Excel article

Click Here for More Excel Tutorials!!!

Get Your FREE pdf of Top Excel Keyboard Shortcuts!

* indicates required

blank

Image-button for Invoice Template for Etsy

Copyright © 2025

  • Home
  • Excel Tutorials
  • Resources
  • About Me
  • Privacy Policy & Terms of Use
  • Disclaimer
  • Advertiser Disclosure
  • Contact Me
  • FREE Printable List of Top Excel Keyboard Shortcuts
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
Do not sell my personal information.
SettingsAccept
Privacy & Cookies Policy

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these cookies, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may have an effect on your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Non-necessary
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
SAVE & ACCEPT