
Excel is a powerful tool, but it often removes leading zeros from numbers automatically. If you need to add a zero at the beginning of a number—such as for ZIP codes, phone numbers, product IDs, or employee codes—you must use the correct method to keep it intact. In this guide, we’ll explore multiple ways to add a zero in front of a number in Excel and ensure your data remains formatted correctly.
Why Does Excel Remove Leading Zeros?
By default, Excel treats numbers as numeric values, which means it automatically strips leading zeros because they hold no mathematical value. For example, if you type “0123”, Excel converts it to 123 instantly. To prevent this, you need to use specific techniques to keep the zero in place.
Let’s explore various methods to add leading zeros in Excel without losing them.
Method 1: Use an Apostrophe (‘) Before the Number
Best for Quick Data Entry Without Formatting Changes
The easiest way to force Excel to recognize a number as text (and keep the leading zero) is to use an apostrophe (‘) before the number.
Steps:
- Click on a cell where you want to enter the number.
- Type an apostrophe (‘) followed by the number (e.g., ‘0123).
- Press Enter. Excel will store the value as text but display it as 0123.
Pros: Quick and easy, no formatting required.
Cons: Data is stored as text, which may cause issues with calculations.
Method 2: Change Cell Format to Text
Best for Data Sets Where All Entries Need Leading Zeros
If you are working with a list of numbers that require leading zeros, it’s better to change the cell formatting to Text before entering the data.
Steps:
- Select the range of cells where you want to enter numbers.
- Go to the Home tab and click on the Number Format dropdown.
- Select Text from the list.
- Enter numbers with leading zeros (e.g., 0123), and Excel will retain them.
Pros: Keeps leading zeros automatically.
Cons: Data is stored as text, so calculations may need conversion functions.
Method 3: Use Custom Number Formatting
Best for Displaying Leading Zeros Without Changing Data Type
This method displays leading zeros but does not alter the underlying numeric value.
Steps:
- Select the cells where you need leading zeros.
- Press Ctrl + 1 (or right-click and choose Format Cells).
- In the Number tab, choose Custom.
- In the Type box, enter 0000 (for a four-digit format) or as many zeros as required.
- Click OK.
For example, entering 123 in a cell formatted as 0000 will display as 0123.
Pros: Keeps data numeric while displaying leading zeros.
Cons: The leading zero only appears in Excel—it won’t be visible in exported files or raw data.
Method 4: Use the TEXT Function
Best for Formulas & Automation
If you need to automatically add leading zeros to existing numbers while keeping the format consistent, the TEXT function is a great choice.
Formula:

This formula ensures that numbers in column A are displayed with four digits, adding leading zeros where necessary (e.g., 123 becomes 0123).
Pros: Works dynamically within formulas.
Cons: Creates a new column of values instead of modifying original data.
Method 5: Use CONCATENATE or TEXTJOIN
Best for Combining Text & Numbers
If you need to merge leading zeros with numbers dynamically, use CONCATENATE or TEXTJOIN.
Formula:

Or (for multiple cells):

This forces a zero before every number in column A.
Pros: Works dynamically and retains leading zeros.
Cons: Outputs are text values, not numbers.
Method 6: Using Power Query (For Large Data Sets)
Best for Bulk Data Processing
For large data sets, Power Query is an efficient tool to add leading zeros.
Steps:
- Select your data and go to Data > Get & Transform > From Table/Range.
- Open Power Query Editor and select the column.
- Click Transform > Add Column > Custom Column.
- Enter the formula:

- Click Close & Load to update your Excel sheet.
Pros: Best for handling large data sets efficiently.
Cons: More advanced; requires Power Query knowledge.
Which Method Should You Use?
| Scenario | Best Method |
| Quick data entry | Apostrophe (‘) before the number |
| Formatting entire columns | Change format to Text |
| Keeping numbers but showing leading zeros | Custom Number Formatting |
| Automatically formatting values | TEXT Function |
| Combining zeros with existing numbers | CONCATENATE or TEXTJOIN |
| Handling large datasets efficiently | Power Query |
Final Thoughts
Adding leading zeros in Excel can be tricky due to its default numeric behavior, but choosing the right method ensures your data stays structured, readable, and accurate. Whether you’re managing ID numbers, invoices, or form entries, you can now confidently apply these techniques to maintain leading zeros in Excel.
