Friday, January 15, 2010

Disappearing Zeros in Excel

I hear this question a lot - In Excel, when I type in a number that has Zeros at the beginning (like a Zip Code), the Zeros disappear - how can I get them back?

First, you need to realize that Excel sets a format for every cell.  The default format depends on the information you type, as Excel tries to read your mind.  Computers are not always good mind readers.

For example:  When you type text in a cell, Excel sets the format of that cell to "text".  When you type a number, it sets the format of that cell to a number.  So, when you type in a Zip Code of "00123", Excel tells you that there are no Zeros needed and places the number "123" in the cell.
 
A quick fix for this is to Right-Click the cell and choose "Format Cells."  In the Format Dialog Box, choose "Custom" and in the "Type" field, type the number of digits for your numbering.  So, in the Example above, you would type "00000" as Zip Codes contain five digits.
 
Once you click "OK", your Disappearing Zeros will Reappear!
 
If you have a group of cells that do not contain a specific number of digits, then you will need to use a macro.  Look for future advanced training on Macros for that fix.

No comments:

Post a Comment

How to Delete Blank Rows in Excel