Software

Entering leading zeroes in Excel

By default, Excel won't display or store leading zeros. Here are three handy ways to get around the problem.

Leading zeros are those pesky place-holding 0 digits at the beginning of a number. Unfortunately, when you enter such a value, Excel applies the General numeric format and tosses out the leading zero. Excel won't display or store the leading 0 digit (see the Formula bar).

When these values are text — part numbers, ZIP codes, and so on — you don't have a problem. Simply precede the value with an apostrophe character ('). You can tell the value is text because it's left-aligned and you can see the apostrophe in the Formula bar. Sometimes, these entries are true numeric values and you will need to evaluate them in mathematical processes. When this is the case, you can force Excel to display placeholder 0 digits by applying a custom format as follows:

  1. Select the cell or range in question.
  2. Right-click the selected cell or range and choose Format Cells from the context menu.
  3. Click the Number tab.
  4. Choose Custom from the Category list.
  5. In the Type field, enter the number of 0s necessary to accommodate the largest value. For instance, if the largest value contains four digits, enter four 0s.
  6. Click OK and Excel displays leading values.

Your users can enter the leading zero(s), or not — Excel won't care. However, this particular format doesn't work with decimal values. If you enter the value .7, the format rounds the value to 1. To accommodate decimal values, enter placeholders for the appropriate number of digits. For instance, if your want Excel to display four digits to the left and two digits to the right of the decimal, enter the custom format 0000.00.

About

Susan Sales Harkins is an IT consultant, specializing in desktop solutions. Previously, she was editor in chief for The Cobb Group, the world's largest publisher of technical journals.

Editor's Picks