xsil
New Member
- Joined
- Dec 7, 2005
- Messages
- 25
Riddle me this.
I would like to extract just the two-letter state code from a string of text in a cell. Note that the two letter state codes do not always appear exactly at the end, so the solution will require something more complex than, say "Right(A1,2)".
For example, in each of the strings of text listed below, I'd be looking for "NY", "AZ", or "CA" to be returned:
Dunkirk NY 013
E Aurora NY
Yuma AZ
Woodland Hills CA (SMATV)
What is the best approach here? I do not believe there is a built in formula for this, so perhaps some VBA code that would recognize the two letter state codes from a separate list.... and then...?
Help!
Thanks very much.
I would like to extract just the two-letter state code from a string of text in a cell. Note that the two letter state codes do not always appear exactly at the end, so the solution will require something more complex than, say "Right(A1,2)".
For example, in each of the strings of text listed below, I'd be looking for "NY", "AZ", or "CA" to be returned:
Dunkirk NY 013
E Aurora NY
Yuma AZ
Woodland Hills CA (SMATV)
What is the best approach here? I do not believe there is a built in formula for this, so perhaps some VBA code that would recognize the two letter state codes from a separate list.... and then...?
Help!
Thanks very much.