Wednesday, July 21, 2010

How to Show leading zeros (pls select display images on your email to view the images)



Sometimes you may need to enter numbers that begin with zeros into a worksheet, such as fixed-length part numbers or serial numbers. By default, Excel drops the leading zeros.

Here are a couple of options:

Option 1 - The Apostrophe Method:

If you just need to enter an occasional number with leading zeros you can simply type an apostrophe before the number (e.g. '00123).

Show leading zeros in Excel using the Apostrophe method

Option 2 - The Custom Number Format Method

Another way is to create a custom number format to display your numbers with leading zeros. In this scenario, your numbers are displayed as fixed-length numbers with leading zeros (e.g. 00123), however, the underlying value in the cell is still the number without the zeros (e.g. 123).

1) Select the cells containing the numbers you want to show leading zeros;

2) in Excel 2007, on the Home tab, click on the Number Format dropdown in the Numbergroup and choose More Number Formats at the bottom of the list. For Excel 2000-2003, from the Format menu select Cells and click the Number tab;

3) In the Category area, select Custom;

4) In the Type field enter zeros for the number of digits you want your numbers displayed.

Display leading zeros in Microsoft Excel by using the Custom Number Format method

Option 3 - The Text Format Method

A third way to enter numbers with leading zeros is to format the range of cells as Text.

To do this...

1) Select the cells to be formatted;

2) In Excel 2007, on the Home tab, click on the Number Format dropdown in the Number group and select Text from the list. In Excel 2000-2003, from the Format menu selectCells, click the Number tab, and select Text from the Category list.

Display leading zeros in Microsoft Excel by using the 'Text format' method

No comments: