+ Reply to Thread
Results 1 to 7 of 7

Parsing Out City and State Formula

  1. #1
    Registered User
    Join Date
    04-08-2011
    Location
    London
    MS-Off Ver
    O 365
    Posts
    80

    Parsing Out City and State Formula

    I'm trying to create a formula that will parse out a field that comes with the city and state combined to two distinct "City" and "State" fields. Currently I'm using two different formulas, one for pulling out the city and the other for pulling out the state. The one for city is: =LEFT(H5,FIND(" ",H5)-1) and the one for state is: =MID(SUBSTITUTE(H2," ","^",LEN(H2)-LEN(SUBSTITUTE(H2," ",""))),FIND("^",SUBSTITUTE(H2," ","^",LEN(H2)-LEN(SUBSTITUTE(H2," ",""))))+1,256)

    The one for state works fine but the one for city doesn't take into consideration if whether or not the city has two names in it. For example, a field containing "CEDAR CREEK NE" parses out to "CREEK" using my current formula. How do I make it recognize when the city is two words and to either parse out one or two, depending on the length?

    Any help is GREATLY appreciated!

    Cheers!

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    Win10/MSO2016
    Posts
    12,994

    Re: Parsing Out City and State Formula

    To attach a Workbook
    (please do not post pictures of worksheets)
    • Click Advanced (next to quick post),
    • Scroll down until you see "Manage Attachments",
    • Click that then select "add files" (top right corner).
    • Click "Select Files" find your file, click "open" click "upload"
    • Once the upload is completed the file name will appear below the input boxes in this window.
    • Click "Done" at bottom right to close the Attachment Manager.
    • Click "Submit Reply"
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    04-08-2011
    Location
    London
    MS-Off Ver
    O 365
    Posts
    80

    Re: Parsing Out City and State Formula

    Attached is an example of what I'm trying to accomplish City State Parsing Example.xlsx

  4. #4
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Parsing Out City and State Formula

    Hi,

    I only see one example in there (?): IDAHO SPRINGS CO

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  5. #5
    Registered User
    Join Date
    04-08-2011
    Location
    London
    MS-Off Ver
    O 365
    Posts
    80

    Re: Parsing Out City and State Formula

    I apologize, I've attached a new example.City State Parsing Example2.xlsx

  6. #6
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    Win10/MSO2016
    Posts
    12,994

    Re: Parsing Out City and State Formula

    try:
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    04-08-2011
    Location
    London
    MS-Off Ver
    O 365
    Posts
    80

    Re: Parsing Out City and State Formula

    Works like a charm, you're the BEST! Thank you kindly

+ 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. What is the formula to add a comma between city and state
    By lilabee in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-11-2012, 12:00 PM
  2. Replies: 2
    Last Post: 02-02-2012, 12:47 AM
  3. Excel 2007 : City State Lookup Match formula help
    By rschopper in forum Excel General
    Replies: 0
    Last Post: 01-27-2011, 03:11 PM
  4. Excel 2007 : city - state formula
    By aj_coolguy in forum Excel General
    Replies: 3
    Last Post: 04-30-2010, 02:52 AM
  5. Splitting City State Zip
    By Pete Provencher in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-07-2005, 06:06 PM

Tags for this Thread

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