How do I extract upper case out of a text

mjmoon

Board Regular
Joined
Mar 1, 2005
Messages
249
My data is in one cell and is NOT consistant. Here is an example of the data:
Collateral: Real Estate - Commercial - Without Dwelling - Brimark - 3200 W 6th St, Small Town, SD.

I want to extract the state out of each cell, so in this example I would want my result in a seperate state to be SD. Sometimes the data has the state and sometimes it doesn't, sometimes the state is in the middle or at the end. Like I said it is not consistant.

Any suggestions on a function that I could use?
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
is there always a period after the state initials like your sample data shows ? if so, can there be periods elsewhere in the data ?
 
Upvote 0
No there is no periods after state abbreviation in any of my data. I put that in there out of habit since it was an end of the sentence, my error, sorry.
 
Upvote 0
Is the state always SD? If it is you can use the following formula
=Mid(A1,FIND("sd",A1),2) where A1 is the cell with you data.
 
Upvote 0
No, there are multiple states but I could possible use your formula on the states most commonly used which may help me trim my data down somewhat.
 
Upvote 0
If there is always a comma before the state you could use Text to Columns to separate it out.
 
Upvote 0
Try this ARRAY ( CTRL > SHIFT > ENTER )

{=INDEX($Z$1:$Z$50,MATCH(TRUE,ISNUMBER(FIND(" "&$Z$1:$Z$50&" "," "&A1&" ")),0))}

where A1 has your string

and E1 thru E50 contains the list of 50 state abbreviations in all caps

will only work if the 2 letter state is always isolated... space directly before and after
 
Last edited:
Upvote 0
Millhouse123 thank you. By using your formula I was able to get my data trimmed down to a level where I can mannually work on it.
 
Upvote 0
DANZON - I like your solution, very creative I would have never thought of that one.

Thank you everybody for you time and comments
 
Upvote 0

Forum statistics

Threads
1,224,584
Messages
6,179,687
Members
452,938
Latest member
babeneker

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