Finding State Only

stroffso

Board Regular
Joined
Jul 12, 2016
Messages
160
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have a list of addresses (Australian) in column B on my worksheet. I want to extract the state only. Note that some states have two characters and others have 3, what is the best formula for this?

Example of the address is as follows. For this I would just want to return "NSW" as the value

[TABLE="width: 790"]
<tbody>[TR]
[TD="class: xl63, width: 790"]400 ELIZABETH STREET,SYDNEY,NSW 2000[/TD]
[/TR]
</tbody>[/TABLE]

thanks
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Assuming that your addresses start at B2 try:

=TRIM(LEFT(RIGHT(SUBSTITUTE(B2,",",REPT(" ",99)),50),LEN(RIGHT(SUBSTITUTE(B2,",",REPT(" ",99)),50))-4))

and copy/fill down
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

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