Excel Removes Leading Zeros When Opening a CSV file

L

lfss

Is there anyway to prevent Excel from removing the leading zeros from a zip code when I export a file from my database into a .csv file? We frequently export data into Excel, but I end up having to retype in hundreds of "0" at the beginning of zip codes. Any help would be greatly appreciated. Thanks in advance.
 
C

CyberTaz

Excel doesn't "remove" anything:) It's just that the number system we use
doesn't support leading 0s for values. Since Excel thinks that's what they
are - the content being only numbers - the default format doesn't allow them
to display (nor does any number format).

Why not just format the cells using Format> Cells - Special, Zip Code? If
the leading 0s were there in the incoming data they'll show up, if they
weren't they'll be added.
 
J

JE McGimpsey

Is there anyway to prevent Excel from removing the leading zeros from a zip
code when I export a file from my database into a .csv file? We frequently
export data into Excel, but I end up having to retype in hundreds of "0" at
the beginning of zip codes. Any help would be greatly appreciated. Thanks in
advance.

If you use the Import Wizard (Data/Get External Data/Import Text
file...) to import your data, you can set the data type of the column to
Text in the third pane of the wizard.

Alternatively, you can import the file, letting XL use its defaults,
then change the formatting of the cells to "00000"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top