+ Reply to Thread
Results 1 to 6 of 6

Zip codes need correcting

  1. #1
    Registered User
    Join Date
    02-26-2015
    Location
    Colchester, CT
    MS-Off Ver
    2013
    Posts
    2

    Wink Zip codes need correcting

    Hi,
    Thanks in advance for your help!
    I received an Excel doc from another source that has the entire column of zip codes entered incorrectly. For example, they are set up as "12345-0000-0000". The last four digits have been repeated. How can I fix all of the zip codes (there are 5,000 rows in the doc)? Is there a way to find and replace?

    Have a great day!

  2. #2
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,463

    Re: Zip codes need correcting

    If all the codes are repeated last four characters:

    =LEFT(A1,LEN(A1)-5)
    Quang PT

  3. #3
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Zip codes need correcting

    Try this formula in B1

    assuming zip codes in column A

    =LEFT(A1,LEN(A1)-5)

    Row\Col
    A
    B
    1
    12345-0000-0000 12345-0000
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  4. #4
    Registered User
    Join Date
    02-26-2015
    Location
    Colchester, CT
    MS-Off Ver
    2013
    Posts
    2

    Re: Zip codes need correcting

    Holy cow, you folks are great! Thanks so much, that worked like a charm. If it's not asking too much, and so I can learn, how did that formula work?

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Zip codes need correcting

    Not to steal their thunder, but they seem to be off-line, so...

    =LEFT(A1,LEN(A1)-5)
    the LEFT() function returns a certain number of characters from the left of a string. The syntax is =LEFT(string,number-of-characters)

    So we have =LEFT(A1...and then how many characters?

    You said the last 4 digits had been repeated, that, plus the dash (-) gives 5 chracters that you want removed, so they need to know how many characters remain.
    =LEN(A1) returns how many characters are in A1, so LEN(A1)-5 gives how many chracters you need

    Hope that made sense?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  6. #6
    Registered User
    Join Date
    01-30-2013
    Location
    Hobart, TAS
    MS-Off Ver
    Office 2003, XL2007
    Posts
    46

    Re: Zip codes need correcting

    A bit late in answering but an alternative solution is

    B1 =SUBSTITUTE(A1,RIGHT(A1,5),"",2)

    HTH

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 1
    Last Post: 12-10-2013, 12:28 AM
  2. Replies: 0
    Last Post: 10-09-2013, 07:59 PM
  3. Combining vba codes makes the previous codes broken !
    By MDPLUS in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-26-2013, 10:00 AM
  4. Replies: 6
    Last Post: 11-28-2006, 01:08 PM
  5. [SOLVED] Correcting a #REF!
    By David Hauck in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-20-2005, 01:20 PM

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