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:

[TABLE="width: 347"]
<colgroup><col></colgroup><tbody>[TR]
[TD]843 E Main Ste 203, Medford, Oregon 97504-7137[/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 347"]
<colgroup><col></colgroup><tbody>[TR]
[TD]7648 Victory Blvd, Newport, Arkansas 72112[/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 347"]
<colgroup><col></colgroup><tbody>[TR]
[TD]Administration Bldg 200; 1509 N Boulder Ave, Russellville, Arkansas 72801-2222[/TD]
[/TR]
</tbody>[/TABLE]

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

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
You're welcome, welcome to the forum, and thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,325
Members
452,635
Latest member
laura12345

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