Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Jun 2003
    New Jersey
    Thanked 0 Times in 0 Posts

    CSV File dropping leading Zeros (Excel 2000)

    How can I keep the leading zeros in a csv file. I have a field called zipcode but when it's saved as a csv file, it's dropping the zeros.
    Help! <img src=/S/hairout.gif border=0 alt=hairout width=31 height=23>

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 31 Times in 31 Posts

    Re: CSV File dropping leading Zeros (Excel 2000)

    Say that your zip codes are in column A (probably as numbers, formatted 00000 if you use 5-digit zip codes)
    Select column B, and insert a new column.
    Format the cells in column B as text.
    Enter zipcode in B1
    In B2, enter this formula: =TEXT(A2,"00000")
    Fill down as far as needed.
    Select column B.
    Copy to the clipboard.
    Select Edit | Paste Special..., Values option, click OK.
    This replaces the formulas by their results.
    Delete column A.
    Exporting to CSV should preserve leading zeros now.

  3. #3
    Uranium Lounger
    Join Date
    Jan 2001
    South Carolina, USA
    Thanked 0 Times in 0 Posts

    Re: CSV File dropping leading Zeros (Excel 2000)

    If you convert the ZIP code column to text, then it should keep the leading zeros when saved to a .csv file. You can't just format the column to Text however. You will need to do the following:

    1- Insert an empty column next to the column containing the ZIP codes.

    2- Assuming that the ZIP codes are in column B starting in row 2, and the empty column is C, then insert this formula in C2:


    3- Copy this formula down column C as far as the ZIP codes go.

    4- Select column B and change the cell format to Text.

    5- Select C2 down to the last cell with the formula.

    6- Select Copy from the Edit menu.

    7- Select cell B2.

    8- Select "Paste Special" from the Edit menu.

    9- In the resulting dialog box, put a tick mark next to Values in the Paste section. Click OK.

    10- You should now have the ZIP codes in column B as text values. You can now delete Column C. Any new ZIP codes you enter in column B should be entered as text values.
    Legare Coleman

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts