Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel2000-When create a csv file loose 0 in zipcode

Status
Not open for further replies.

markajem

Programmer
Dec 20, 2001
564
US
I presently have a file that I want to create a csv with so I can pick it up in a label printing program. My problem is that any zipcodes that start with a 0 are lost when I save the file as a csv. Example: 07740 becomes 7740. I have tried formatting the xls file as text and zipcode for this column in the spreadsheet. But when I go to save it a pop up says saving it in this file format may cause you to loose some formatting. If I click yes to save in this csv format I do loose the 0 at the start of the zip code if I click No then I have to save in another file format.

Can someone please share with me the secret to doing this correctly.

Thanks for your time.
 


Thats because your ZIP codes are NUMBER instead of TEXT.

ZIP codes should never be entered as numbers, even though they are only numeric characters, since you'll never do arithmetic on them.

However, the LEADING ZERO FORMAT is very important. Formatting a NUMBER does not change the underlying value and it's the VALUE that gets exported.

So dispite the fact that you might FORMAT a 1 to DISPLAY 00001, the VALUE is still 1.

The number 1 and the TEXT value 00001 are vastly different stored values.

Bottom line: CHANGE the ZIP values to TEXT. If your ZIP is in A1...
[tt]
=TEXT(A1,"00000")
[/tt]


Skip,
[sub]
[glasses] [red]Be Advised![/red]
The band of elderly oriental musicians, known as Ground Cover, is, in reality...
Asian Jasmine![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top