Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

. asked in Computers & InternetSoftware · 7 years ago

How to extract words in excel?

All of this text is in 1 cell:

________________________

123 Main Street Avenue

Anchorage, ALASKA 99501

UNITED STATES

________________________|

I need to extract "Anchorage" and "99501" into 2 different cells.

I need this so it will work with any address, they are all formatted the same.

Update:

Here is my formula

=MID(LEFT(A469,FIND(",",A469)-1),FIND(CHAR(10),A469)+1,LEN(A469))

However, it does not work when line 1 has a comma in it. For instance:

________________________

123 Main Street, Suite 100

Anchorage, ALASKA 99501

UNITED STATES

________________________|

3 Answers

Relevance
  • 7 years ago

    This can be done, but it is a tedious process. As a start, you can go to the menu item Data | Text to columns… and tick the space box to use as a delimiter. This will separate each word into a separate column, but the problem is then that with road names of different sizes you will find that the town and zip code do not line up.

    I recommend that you go back to the original data and separate the data with commas, as in

    123,Main Street Avenue,Anchorage,ALASKA,99501,UNITED STATES

    You can then use the text to columns feature with the comma as a delimiter, and everything will line up perfectly.

  • IXL@XL
    Lv 7
    7 years ago

    this solution relies on the address being constructed using ALT+ENTER (linefeeds)

    A2 is adddress

    A4 =SUBSTITUTE(A2,CHAR(10),"#")

    A6 =MID(A4,FIND("#",A4)+1,LEN(A4))

    A8 =MID(A6,1,FIND("#",A6,1)-1)

    A10 =CONCATENATE(LEFT(A8,FIND(" ",A8)), RIGHT(A8,5))

    ZIP is assumed to be 5 digits, and only extracts single name locations (state name creates problem with multi name addresses).

    Hope this is of some use.

  • ?
    Lv 6
    7 years ago

    For the city you could try

    =MID(A1,FIND(CHAR(10),A1)+1, FIND(",",A1)-FIND(CHAR(10), A1)-1)

    For the zip

    =MID(A1,FIND("^", SUBSTITUTE(A1&CHAR(10),CHAR(10), "^",2))-5,5)

Still have questions? Get your answers by asking now.