Extract State name from Address

teston

New Member
Joined
Feb 5, 2019
Messages
6
Hello,

I have a bunch of addresses where I need to extract state name to a new cell.

The addresses look the following way:

843 E Main Ste 203, Medford, Oregon 97504-7137

<colgroup><col></colgroup><tbody>
</tbody>
7648 Victory Blvd, Newport, Arkansas 72112

<colgroup><col></colgroup><tbody>
</tbody>
Administration Bldg 200; 1509 N Boulder Ave, Russellville, Arkansas 72801-2222

<colgroup><col></colgroup><tbody>
</tbody>

I have used Rick Rothstein's solution from another thread to extract cities and it works flawlessly even with additions to address like "Administration Bldg 200;".

However, how do I extract state names? The only pattern I see here is that state name always comes after last comma and before the zip code.

Thanks!
 
Hi,

Since there are State names that contain more than a Single word, this will handle them also:


Book1
AB
1843 E Main Ste 203, Medford, Oregon 97504-7137Oregon
27648 Victory Blvd, Newport, Arkansas 72112Arkansas
3Administration Bldg 200; 1509 N Boulder Ave, Russellville, Arkansas 72801-2222Arkansas
47648 Victory Blvd, New York, New York 72112New York
5843 E Main Ste 203, Medford, North Carolina 97504-7137North Carolina
Sheet544
Cell Formulas
RangeFormula
B1=TRIM(SUBSTITUTE(TRIM(RIGHT(SUBSTITUTE(A1,", ",REPT(" ",99),LEN(A1)-LEN(SUBSTITUTE(A1,",",""))),99)),TRIM(RIGHT(SUBSTITUTE(A1," ",REPT(" ",99)),99)),""))
 
Upvote 0

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
You're welcome, welcome to the forum, and thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,951
Messages
6,122,446
Members
449,083
Latest member
Ava19

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top