+ Reply to Thread
Results 1 to 5 of 5

Parse City State Zip

  1. #1
    Registered User
    Join Date
    02-09-2017
    Location
    USA
    MS-Off Ver
    2016
    Posts
    4

    Parse City State Zip

    Some nitwit gave me a list that looks like this:

    Rochester NY 14617-2346
    Buffalo NY 14216-1530
    Johnson City NY 13790-2504
    Amherst NY 14228

    Sometimes the city name is two names and sometimes the zip codes are not +4.

    I need a formula that will parse city, state, and zip.

    We are using Excel 2010.
    Last edited by queenbean84; 11-07-2017 at 10:08 AM. Reason: add excel version

  2. #2
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: Parse City State Zip

    You need a list of states that are 2 letters, you can then use this to split the string.

  3. #3
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Parse City State Zip

    With your strings starting in A2, try these:

    D2 =TRIM(RIGHT(SUBSTITUTE(A2," ",REPT(" ",LEN(A2))),LEN(A2)))
    C2 =RIGHT(SUBSTITUTE(A2," "&D2,""),2)
    B2 =LEFT(A2,LEN(A2)-LEN(C2&D2)-2)

  4. #4
    Registered User
    Join Date
    02-09-2017
    Location
    USA
    MS-Off Ver
    2016
    Posts
    4

    Re: Parse City State Zip

    Quote Originally Posted by 63falcondude View Post
    With your strings starting in A2, try these:

    D2 =TRIM(RIGHT(SUBSTITUTE(A2," ",REPT(" ",LEN(A2))),LEN(A2)))
    C2 =RIGHT(SUBSTITUTE(A2," "&D2,""),2)
    B2 =LEFT(A2,LEN(A2)-LEN(C2&D2)-2)
    Thanks! That worked! The state ended up being "Y" but since it's all NY, I can easily change it.

  5. #5
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Parse City State Zip

    That's odd. Is there more than one space between the state and zip?

    Either way, if you're happy with the solution provided, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ 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. How to Parse Street, City, State, and Zip Code into Separate Values. In Textbox
    By jarekmos in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-27-2017, 05:30 PM
  2. [SOLVED] City and State Separation
    By burcha22 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-17-2017, 04:40 PM
  3. Separate city state and zip
    By cape in forum Excel General
    Replies: 7
    Last Post: 11-16-2015, 07:48 PM
  4. Charting City & State
    By Cristina.Pride in forum Excel Charting & Pivots
    Replies: 6
    Last Post: 07-11-2014, 08:59 AM
  5. I need Help to parse address city state zip and country if applicable for all fields
    By danpotash in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-01-2013, 03:16 PM
  6. How to get rid of the city and state in the address?
    By excel1212 in forum Excel General
    Replies: 2
    Last Post: 09-08-2012, 05:30 PM
  7. identify city, state zip
    By Dave B in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-17-2005, 11:05 AM

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