Extract City and State from address

scojax22

New Member
Joined
Apr 1, 2014
Messages
12
Office Version
  1. 365
Platform
  1. Windows
I have a database of full addresses, including city and state in 1 cell. I want to add two new columns for city and state, and need a formula for each - I am using Left(Find",") to extract the address and Right(5) for the zip - but the city and state are giving me problems.

Any help would be great.

Ex: 101 Main Street, Cherry Hill, NJ 08510
 
Another option
Fluff.xlsm
ABC
1
281 Ghostgum Bvd, Banksia Grove, WA, 6031Banksia GroveWA
3150 Camborne Pwy, Butler, WA, 6036ButlerWA
4Cnr Yanchep Beach Rd & Marmion Ave, Yanchep, WA, 6035YanchepWA
5Centro Stirling, 54 Sanford St, Geraldton, WA, 6530GeraldtonWA
6Lakeside Joondalup Shop. Ctr, 420 Joondalup Dr, Joondalup, WA, 6027JoondalupWA
719 Neerabup Road, Clarkson, WA, 6030ClarksonWA
8Stirling Central Shop. Ctr, 478 Wanneroo Rd, Westminster, WA, 6061WestminsterWA
9Dog Swamp Shop. Ctr, 6 Wanneroo Rd, Yokine, WA, 6060YokineWA
10Glenview MarketPl, Cnr Hamelin And Bellefin Drs, Ballajura, WA, 6066BallajuraWA
11360-366 Grand Promenade, Dianella, WA, 6059DianellaWA
12111 Main Street, Newark, NJ, 12345NewarkNJ
Sheet6
Cell Formulas
RangeFormula
B2:C12B2=CHOOSECOLS(TRIM(TEXTSPLIT(A2,",")),-3,-2)
Dynamic array formulas.
 
Upvote 0

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Or maybe:

Book3
ABC
181 Ghostgum Bvd, Banksia Grove, WA, 6031Banksia GroveWA
2150 Camborne Pwy, Butler, WA, 6036ButlerWA
3Cnr Yanchep Beach Rd & Marmion Ave, Yanchep, WA, 6035YanchepWA
4Centro Stirling, 54 Sanford St, Geraldton, WA, 6530GeraldtonWA
5Lakeside Joondalup Shop. Ctr, 420 Joondalup Dr, Joondalup, WA, 6027JoondalupWA
619 Neerabup Road, Clarkson, WA, 6030ClarksonWA
7Stirling Central Shop. Ctr, 478 Wanneroo Rd, Westminster, WA, 6061WestminsterWA
8Dog Swamp Shop. Ctr, 6 Wanneroo Rd, Yokine, WA, 6060YokineWA
9Glenview MarketPl, Cnr Hamelin And Bellefin Drs, Ballajura, WA, 6066BallajuraWA
10360-366 Grand Promenade, Dianella, WA, 6059DianellaWA
11111 Main Street, Newark, NJ, 12345NewarkNJ
Sheet1
Cell Formulas
RangeFormula
B1:B11B1=TEXTAFTER(TEXTBEFORE(A1,", ",-2),", ",-1)
C1:C11C1=LEFT(TEXTAFTER(A1,", ",-2),2)
[XD]=TEXTAFTER(TEXTBEFORE(A1,", ",-2),", ",-1)[/XD][/XR][/RANGE]

Many thanks @kweaver

I have used your formula from B1 and extrapolated into street field 2 and state field... your formula from C2 didn't work where my state codes were 3 letters.

Summer Reset Program - Gloves.xlsx
GHIJKL
281 Ghostgum Bvd, Banksia Grove, WA, 603181 Ghostgum Bvd Banksia GroveWA6031
3150 Camborne Pwy, Butler, WA, 6036150 Camborne Pwy ButlerWA6036
4Cnr Yanchep Beach Rd & Marmion Ave, Yanchep, WA, 6035Cnr Yanchep Beach Rd & Marmion Ave YanchepWA6035
5Centro Stirling, 54 Sanford St, Geraldton, WA, 6530Centro Stirling54 Sanford StGeraldtonWA6530
6Lakeside Joondalup Shop. Ctr, 420 Joondalup Dr, Joondalup, WA, 6027Lakeside Joondalup Shop. Ctr420 Joondalup DrJoondalupWA6027
4836-38 Hartley St, Alice Springs, NT, 87036-38 Hartley St Alice SpringsNT870
49247 Trower Rd, Casuarina, NT, 810247 Trower Rd CasuarinaNT810
50Tenants PO Box 80, Gateway Shopping Centre, 1 Roystonea Avenue Yarrawonga NT 0832, Palmerston, NT, 830Tenants PO Box 80 1 Roystonea Avenue Yarrawonga NT 0832PalmerstonNT830
51Newton Village Shop. Ctr, 299 Montacute Rd, Newton, SA, 5074Newton Village Shop. Ctr299 Montacute RdNewtonSA5074
5227 Liverpool St, Port Lincoln, SA, 560627 Liverpool St Port LincolnSA5606
53976 North East Rd, Modbury, SA, 5092976 North East Rd ModburySA5092
54Renmark Shop. Ctr, Renmark Ave, Renmark, SA, 5341Renmark Shop. CtrRenmark AveRenmarkSA5341
55Centre Plaza, Cnr Fifteenth St And Deakin Ave, Mildura, VIC, 3500Centre PlazaCnr Fifteenth St And Deakin AveMilduraVIC3500
56297 Peachey Rd, Munno Para West, SA, 5115297 Peachey Rd Munno Para WestSA5115
571 Forster St, Kadina, SA, 55541 Forster St KadinaSA5554
58382-396 Watterloo Crn Rd, Burton, SA, 5110382-396 Watterloo Crn Rd BurtonSA5110
59Northpark Shop. Ctr, 264 Main North Rd, Prospect, SA, 5082Northpark Shop. Ctr264 Main North RdProspectSA5082
6011 Interchange Place, Rochedale, QLD, 412311 Interchange Place RochedaleQLD4123
61Stocklands Shoppingtown, 537 Mulgrave Rd, Earlville, QLD, 4870Stocklands Shoppingtown537 Mulgrave RdEarlvilleQLD4870
62Cnr Alfred Street and Koch Street, Manunda, QLD, 4870Cnr Alfred Street and Koch Street ManundaQLD4870
6363 Front St, Mossman, QLD, 487363 Front St MossmanQLD4873
Sheet1
Cell Formulas
RangeFormula
H2:H6,H48:H63H2=LEFT(G2,FIND(",",G2)-1)
I2:I6,I48:I63I2=TEXTAFTER(TEXTBEFORE(G2,", ",-3,,,""),", ",-1,,,"")
J2:J6,J48:J63J2=TEXTAFTER(TEXTBEFORE(G2,", ",-2),", ",-1)
K2:K6,K48:K63K2=TEXTAFTER(TEXTBEFORE(G2,", ",-1),", ",-1)
L2:L6,L48:L63L2=RIGHT(G2,4)
 
Upvote 0
@Warwick89
Could you manually complete the expected results (all columns) for the sample data in post 12 (or at least enough of the rows to give an example of all the variations possible with your data) and post that with XL2BB?
 
Upvote 0
Many thanks @kweaver

I have used your formula from B1 and extrapolated into street field 2 and state field... your formula from C2 didn't work where my state codes were 3 letters.

Summer Reset Program - Gloves.xlsx
GHIJKL
281 Ghostgum Bvd, Banksia Grove, WA, 603181 Ghostgum Bvd Banksia GroveWA6031
3150 Camborne Pwy, Butler, WA, 6036150 Camborne Pwy ButlerWA6036
4Cnr Yanchep Beach Rd & Marmion Ave, Yanchep, WA, 6035Cnr Yanchep Beach Rd & Marmion Ave YanchepWA6035
5Centro Stirling, 54 Sanford St, Geraldton, WA, 6530Centro Stirling54 Sanford StGeraldtonWA6530
6Lakeside Joondalup Shop. Ctr, 420 Joondalup Dr, Joondalup, WA, 6027Lakeside Joondalup Shop. Ctr420 Joondalup DrJoondalupWA6027
4836-38 Hartley St, Alice Springs, NT, 87036-38 Hartley St Alice SpringsNT870
49247 Trower Rd, Casuarina, NT, 810247 Trower Rd CasuarinaNT810
50Tenants PO Box 80, Gateway Shopping Centre, 1 Roystonea Avenue Yarrawonga NT 0832, Palmerston, NT, 830Tenants PO Box 80 1 Roystonea Avenue Yarrawonga NT 0832PalmerstonNT830
51Newton Village Shop. Ctr, 299 Montacute Rd, Newton, SA, 5074Newton Village Shop. Ctr299 Montacute RdNewtonSA5074
5227 Liverpool St, Port Lincoln, SA, 560627 Liverpool St Port LincolnSA5606
53976 North East Rd, Modbury, SA, 5092976 North East Rd ModburySA5092
54Renmark Shop. Ctr, Renmark Ave, Renmark, SA, 5341Renmark Shop. CtrRenmark AveRenmarkSA5341
55Centre Plaza, Cnr Fifteenth St And Deakin Ave, Mildura, VIC, 3500Centre PlazaCnr Fifteenth St And Deakin AveMilduraVIC3500
56297 Peachey Rd, Munno Para West, SA, 5115297 Peachey Rd Munno Para WestSA5115
571 Forster St, Kadina, SA, 55541 Forster St KadinaSA5554
58382-396 Watterloo Crn Rd, Burton, SA, 5110382-396 Watterloo Crn Rd BurtonSA5110
59Northpark Shop. Ctr, 264 Main North Rd, Prospect, SA, 5082Northpark Shop. Ctr264 Main North RdProspectSA5082
6011 Interchange Place, Rochedale, QLD, 412311 Interchange Place RochedaleQLD4123
61Stocklands Shoppingtown, 537 Mulgrave Rd, Earlville, QLD, 4870Stocklands Shoppingtown537 Mulgrave RdEarlvilleQLD4870
62Cnr Alfred Street and Koch Street, Manunda, QLD, 4870Cnr Alfred Street and Koch Street ManundaQLD4870
6363 Front St, Mossman, QLD, 487363 Front St MossmanQLD4873
Sheet1
Cell Formulas
RangeFormula
H2:H6,H48:H63H2=LEFT(G2,FIND(",",G2)-1)
I2:I6,I48:I63I2=TEXTAFTER(TEXTBEFORE(G2,", ",-3,,,""),", ",-1,,,"")
J2:J6,J48:J63J2=TEXTAFTER(TEXTBEFORE(G2,", ",-2),", ",-1)
K2:K6,K48:K63K2=TEXTAFTER(TEXTBEFORE(G2,", ",-1),", ",-1)
L2:L6,L48:L63L2=RIGHT(G2,4)

Suppose you change the second formula to: =TEXTBEFORE(TEXTAFTER(A1:A11,", ",-2),",")

Book1
ABC
181 Ghostgum Bvd, Banksia Grove, WA, 6031Banksia GroveWA
2150 Camborne Pwy, Butler, WA, 6036ButlerWA
3Cnr Yanchep Beach Rd & Marmion Ave, Yanchep, WA, 6035YanchepWA
4Centro Stirling, 54 Sanford St, Geraldton, WA, 6530GeraldtonWA
5Lakeside Joondalup Shop. Ctr, 420 Joondalup Dr, Joondalup, WA, 6027JoondalupWA
619 Neerabup Road, Clarkson, WA, 6030ClarksonWA
7Stirling Central Shop. Ctr, 478 Wanneroo Rd, Westminster, WA, 6061WestminsterWA
8Dog Swamp Shop. Ctr, 6 Wanneroo Rd, Yokine, WA, 6060YokineWA
9Glenview MarketPl, Cnr Hamelin And Bellefin Drs, Ballajura, WA, 6066BallajuraWA
10360-366 Grand Promenade, Dianella, WA, 6059DianellaWA
11111 Main Street, Newark, NNJ, 12345NewarkNNJ
Sheet1
Cell Formulas
RangeFormula
B1:B11B1=TEXTAFTER(TEXTBEFORE(A1:A11,", ",-2),", ",-1)
C1:C11C1=TEXTBEFORE(TEXTAFTER(A1:A11,", ",-2),",")
Dynamic array formulas.
 
Upvote 0
Here is a single formula (placed in cell B1) which will automatically fill Columns B and C with the desired data...
Excel Formula:
=TEXTSPLIT(TEXTAFTER(A1:A11,", ",{-3,-2}),", ")
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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