List Your Business in Our Directory Now! 

How to Keep Leading Zero in Excel

Written by:

Last updated:

How to Keep Leading Zero in Excel

Keeping leading zeros in Excel can be a tricky task if you don’t know the right formatting techniques. It’s often a problem when working with codes, ZIP codes, or any data that starts with zeros. You may have noticed that Excel automatically drops the leading zeros in such data when you enter them. If you need to keep those zeros in your Excel worksheet, there are different ways to do it. In this post, we’ll discuss the different methods you can use to keep leading zeros in Excel, so you can ensure your data stays consistent and accurate.

Method 1: Format Cells as Text

If you need to keep the leading zeros in a cell, you can format the cell as Text before entering the data. This tells Excel to treat the data in that cell as text, not a number, and prevents it from removing any leading zeros.

Step 1:

Select the cells where you want to enter data that starts with a zero.

Step 2:

Right-click on the selected cells and choose Format Cells from the context menu.

Step 3:

In the Format Cells dialog box, select the Text option under Category.

Step 4:

Click OK to apply the formatting.

Step 5:

Now you can enter data with leading zeros, and Excel will not remove them from the cell.



Method 2: Use an Apostrophe

Another way to keep leading zeros in Excel is to use an apostrophe before the data. The apostrophe tells Excel to treat the data in that cell as text, not a number, and to display it as entered.

Step 1:

Enter an apostrophe ( ‘ ) before the data in the cell.

Step 2:

Press Enter to complete the entry.

Step 3:

The apostrophe will not be displayed in the cell, and the leading zeros will be retained.

Method 3: Use the TEXT Function

You can use the TEXT function to convert a number to text, and specify the number of digits to display. This method not only retains leading zeros, but it also allows you to display the number in a specific format, such as currency or percentage.

Step 1:

Enter the number you want to convert to text in a cell.

Step 2:

In another cell, enter the following formula:

=TEXT(cell reference,"00000")

Replace “cell reference” with the reference of the cell where you entered the number, and “00000” with the number of digits you want to display, including leading zeros.

Step 3:

The formula will return the number as text with the specified number of digits, including leading zeros.

These are three easy ways to keep leading zeros in Excel. Next time you work with codes or any data that starts with zeros, use these techniques to keep the zeros in the right place.

When to Use Leading Zeros in Excel

Leading zeros are commonly used in Excel for codes, ZIP codes, phone numbers, and other data that may begin with a zero. In these cases, leading zeros are significant and should not be removed by Excel.

For example, in a phone number, the leading zero(s) may represent the area code for the call’s final destination. Excel will discard any leading zeros entered in a cell by default. Still, this action can cause problems in these types of data if the information is to be used for subsequent analysis or sorting. Excel can be instructed to retain the leading zeroes by using the methods shown above.

How to Remove Leading Zeros in Excel

Removing leading zeros in Excel is very similar to the previous methods, except that you change the formatting to remove leading zeros. If you have numbers formatted as text with leading zeros that you need to convert back to regular numbers, you can follow these simple steps in Excel:

Step 1:

Select the cells where you want to remove leading zeros.

Step 2:

Right-click on the selected cells and choose Format Cells from the context menu.

Step 3:

In the Format Cells dialog box, select the Number option under Category.

Step 4:

Choose the desired option under the Number category for your data to be displayed without leading zeros.

Step 5:

Click OK to apply the formatting. The leading zeros will be removed from the selected cells.

Excel’s ability to automatically remove leading zeros has been known to cause some trouble for users, especially when working with codes, ZIP codes, or any data that starts with zeros. The methods laid out above will help you retain those zeros and ensure your data stays consistent and accurate. Use these techniques to make sure that you keep and remove leading zeros appropriately in Excel.

FAQs: How to Keep Leading Zeros in Excel

Below are some common questions regarding how to keep leading zeros in Excel:

Q: Why does Excel remove leading zeros?

A: Excel automatically drops leading zeros to make sure data is consistently formatted as a number. However, this can cause issues when handling certain types of data, such as ZIP codes and phone numbers.

Q: Can I add zeros to the beginning of a number in Excel?

A: Yes, you can add zeros to the beginning of a number in Excel by formatting the cell as text and entering the number. Alternatively, you can use an apostrophe to signify that the entry is text or use the TEXT function to add zeros.

Q: Can I modify an existing Excel worksheet to keep leading zeros?

A: Yes, you can modify an existing Excel worksheet to keep leading zeros by selecting the cell(s) you want to format, right-clicking and selecting Format Cells, and then choosing the Text option or following one of the other methods discussed in this post.

Q: Will my formulae work when I format a cell as text?

A: If your formula relies on the numeric output from the cell, you should not format the cell as text. However, if your formula relies on a string of text in the cell, you can format the cell as text and your formula will work correctly.

Q: How do I remove leading zeros without deleting them?

A: To remove the leading zeros from a cell or range of cells, you can right-click, select Format Cells, choose Number under Category, and select the desired format.

Bill Whitman from Learn Excel

I'm Bill Whitman, the founder of LearnExcel.io, where I combine my passion for education with my deep expertise in technology. With a background in technology writing, I excel at breaking down complex topics into understandable and engaging content. I'm dedicated to helping others master Microsoft Excel and constantly exploring new ways to make learning accessible to everyone.

Categories How To

Featured Companies

  • Learn PowerPoint

    Explore the world of Microsoft PowerPoint with LearnPowerpoint.io, where we provide tailored tutorials and valuable tips to transform your presentation skills and clarify PowerPoint for enthusiasts and professionals alike.

    Learn PowerPoint
  • Learn Word

    Your ultimate guide to mastering Microsoft Word! Dive into our extensive collection of tutorials and tips designed to make Word simple and effective for users of all skill levels.

    Learn Word
  • Resultris Marketing

    Boost your brand's online presence with Resultris Content Marketing Subscriptions. Enjoy high-quality, on-demand content marketing services to grow your business.

    Resultris Marketing

Other Categories

Expand Your Market with a Listing in Our Excel-Focused Directory!