City State Zip Extraction

mkane12

New Member
Joined
Oct 2, 2024
Messages
1
Office Version
  1. 365
Platform
  1. Windows
what is a good formula to extract a city, state and zip? Some have commas, some don't. Some cities are more than one word too which makes it not work for some.

Here is what I've done but it only works when it is a one worded city with a comma:

example:
Gurnee, IL 60031
=Left(B1,SEARCH(",",B1)-1)
---> result : Gurnee

example:
San Diego, CA
-->what is a formula I can use with the above one? Maybe throw in an IF statement to do with the spaces?
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Welcome to the Board!

A few questions:
- Are you trying to extract City, State and Zip into 3 different cells?
- Do the entries just have City, State, and Zip and not anything else (i.e. no names or street addresses or country codes)?
- Are the zip codes always 5 digits, or may there be some extended zip codes (9 or 10 digits)?
- Are the states always the 2 digit abbreviation?
- Can you show us a representative sample of different variations, so we make sure we account for all the different variations?
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,241
Members
452,622
Latest member
Laura_PinksBTHFT

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