+ Reply to Thread
Results 1 to 3 of 3

Converting 9-digit zip codes to 5-digit zip codes

  1. #1
    Registered User
    Join Date
    10-14-2008
    Location
    Claxton, GA
    MS-Off Ver
    Microsoft Office 2007 - Excel 2007
    Posts
    7

    Converting 9-digit zip codes to 5-digit zip codes

    I have an Excel file (using Excel 2007) which has a column devoted to zip codes. I have it formatted as "Custom" - "Zip Code" (not Zip + 4). The entries in the file are generated from imported information from an external file. The file comes in as a CSV file. I convert it to an Excel file. Here's the problem....some of the zip codes have the 9-digit format while some of the zip codes have the 5-digit format. I would like to make all the zip codes in the column "5-digit" which means I need to drop the "dashes" and the last four digits from all the 9-digit zips. I've tried everything I know, but nothing seems to work. Last night, I went down a column of 500+ zips and manually corrected them. This just doesn't work. I posted this issue earlier....got a response called "zip code fixer.xls", but I don't know how it works. I would appreciate anyone giving me some hints on how to collapse all these 9-digit zips into 5-digit zips. Thanks very much. WDP

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Does this formula work

    =IF(LEN(A1)=5,A1,LEFT(SUBSTITUTE(A1,"-",""),5))

    Where A1 contain
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Contributor beeawwb's Avatar
    Join Date
    01-04-2004
    Location
    Perth, WA, Australia
    MS-Off Ver
    Microsoft Office Excel 2003 (11.8146.8221) SP2
    Posts
    105
    Why not just use =Left(A1,5), copied down. If you know that you always want the 5 digit zip, then the 5 digit ones will remain the same, and the 9 digit ones will be truncated.

    -Bob

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1