**Please Note: **
This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), *this tip may not work for you*. For a version of this tip written specifically for later versions of Excel, click here: Getting Rid of Leading Zeros in a Number Format.

Written by Allen Wyatt (last updated July 6, 2020)**This tip applies to** Excel 97, 2000, 2002, and 2003

When you enter a numeric value into a cell, by default Excel will display a leading zero on values that are less than 1. For instance, if you enter the value 1.234 into a cell, Excel displays just that: 1.234. If you enter .234 into the same cell, Excel includes the leading zero: 0.234.

If you want to get rid of the leading zeros, then you need to rely upon a custom format. This is rather easy to create; just follow these steps:

- Select the cell (or cells) that you want to format.
- Choose Cells from the Format menu. Excel displays the Format Cells dialog box.
- If the Number tab is not displayed, select it.
- In the Category list, choose Custom. The dialog box changes so you can enter a custom format. (See Figure 1.)
- In the Type box, enter the following pattern:
**.###** - Click OK.

** Figure 1.** The Number tab of the Format Cells dialog box.

That's it; the number in the cell will no longer have a leading zero if it is less than 1. There are some caveats to this, however. First, if the number you enter in the cell has more than three digits after the decimal place, then the number will be rounded (for display purposes) to only three digits. If you are going to routinely have more than three digits in the value, you should increase the number of hash marks (#) in the custom format.

Second, if the value you enter into the cell has fewer than three digits to the right of the decimal place, then only the number of digits required will be displayed. Thus, if you have multiple cells formatted this way, it is very possible for the numbers to not "line up" along the decimal point. The solution to this is to change the format to something that will always display the same number of digits after the decimal point. A good choice is, in step 5, use the format ".000" (without the quote marks). This format will always display three digits after the decimal point, adding zeros to the end of the value, if necessary.

You could also change the format a bit if you want things to line up on the decimal point, but you don't want any trailing zeros. Try replacing the hash marks (#) in the custom format in step 5 with question marks. Thus, you would use ".???" instead of ".###". This results in up to three digits being displayed, but if there are fewer than three digits the remaining question marks are replaced with spaces.

Third, if the value you enter into the cell is a whole number, then it will always be displayed with a decimal point. Thus, entering 3 in the cell results in the display of 3., with the decimal point. For most people this won't be a big deal, and there is no easy way to modify the custom format to remove the decimal point from whole numbers.

Fourth, if you enter 0 in the cell, it won't be displayed at all. Instead you get a single decimal point in the cell and nothing else. The way around this problem is to make your custom format just a bit more complex. In step 5, above, enter the following as the custom format:

[=0]0;[<1].000;General

This custom format indicates that a 0 value should be shown as 0, any value less than 1 should be shown with no leading zero and three digits to the right of the decimal point, and anything else should be displayed using the General format.

*ExcelTips* is your source for cost-effective Microsoft Excel training.
This tip (10029) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: **Getting Rid of Leading Zeros in a Number Format**.

**Comprehensive VBA Guide** Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out *Mastering VBA for Office 2010* today!

Professional typesetting has, in many ways, spoiled us. One way this is evident is in the preference we show for making ...

Discover MoreThe Format Painter is great for copying formatting from one cell to another. If you don't want to grab the mouse to use ...

Discover MoreA handy way to store latitude and longitude values in Excel is to treat them as regular time values. When it comes around ...

Discover More**FREE SERVICE:** Get tips like this every week in *ExcelTips,* a free productivity newsletter. Enter your address and click "Subscribe."

2020-02-17 07:23:45

One thing that can be improved on “[=0]0;[<1].000;General” is to line up the numbers as far as possible. (Currently, zeroes and numbers ≥ 1 have a different decimal position from the values <1.) So, how about “[=0].0??;[<1E6].???;#.#E-#”? This only falls back to another format (for which I use exponential, but General would work, too) as a last resort.

Got a version of Excel that uses the
menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)?
**This site is for you!** If you
use a later version of Excel, visit
our *ExcelTips* site focusing on the ribbon interface.

**FREE SERVICE:** Get tips like this every week in *ExcelTips,* a free productivity newsletter. Enter your address and click "Subscribe."

Copyright © 2024 Sharon Parq Associates, Inc.

## Comments