Excel Formula: Getting the city name - non-US

kingfsx

New Member
Joined
Nov 7, 2019
Messages
1
Hi all,

First and foremost, I want to thank who will help since I'm new with excel's formula

Here is my data:

SM NORTH EDSA PAG ASA 1, QUEZON CITY, 1105
4390 DAYAP COR. CUENCA STS., BRGY., PALANAN, MAKATI CITY
RM 313 LAPERAL BLDG. SESSION ROAD, BAGUIO CITY

I just want to extract the city name, all addresses includes the word CITY... and I want to get the previous word which is the actual city name.

I should be able to extract from the data above:
QUEZON
MAKATI
BAGUIO

Then afterwards, I want to delete the following from the data:
QUEZON CITY
MAKATI CITY
BAGUIO CITY

Thank you!!!!
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Welcome to the MrExcel board!

I assume that it is possible to have a city name consisting of more than one word, so try this

<b>City</b><br /><br /><table border="1" cellspacing="0" cellpadding="0" style="font-family:Arial,Arial; font-size:8pt; background-color:#ffffff; padding-left:2pt; padding-right:2pt; "> <colgroup><col style="font-weight:bold; width:30px; " /><col style="width:478px;" /><col style="width:140px;" /></colgroup><tr style="background-color:#cacaca; text-align:center; font-weight:bold; font-size:8pt; "><td > </td><td >A</td><td >B</td></tr><tr style="height:21px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >2</td><td style="font-size:10pt; ">SM NORTH EDSA PAG ASA 1, QUEZON CITY, 1105</td><td style="font-size:10pt; ">QUEZON</td></tr><tr style="height:21px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >3</td><td style="font-size:10pt; ">4390 DAYAP COR. CUENCA STS., BRGY., PALANAN, MAKATI CITY</td><td style="font-size:10pt; ">MAKATI</td></tr><tr style="height:21px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >4</td><td style="font-size:10pt; ">RM 313 LAPERAL BLDG. SESSION ROAD, BAGUIO CITY</td><td style="font-size:10pt; ">BAGUIO</td></tr><tr style="height:21px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >5</td><td style="font-size:10pt; ">RM 313 LAPERAL BLDG. SESSION ROAD, TWO WORD CITY</td><td style="font-size:10pt; ">TWO WORD</td></tr></table><br /><table style="font-family:Arial; font-size:10pt; border-style: groove ;border-color:#00ff00;background-color:#fffcf9; color:#000000; "><tr><td ><b>Spreadsheet Formulas</b></td></tr><tr><td ><table border = "1" cellspacing="0" cellpadding="2" style="font-family:Arial; font-size:9pt;"><tr style="background-color:#cacaca; font-size:10pt;"><td >Cell</td><td >Formula</td></tr><tr><td >B2</td><td >=TRIM(RIGHT<span style=' color:008000; '>(SUBSTITUTE<span style=' color:#0000ff; '>(LEFT<span style=' color:#ff0000; '>(A2,SEARCH<span style=' color:#804000; '>(" CITY",A2)</span>-1)</span>,",",REPT<span style=' color:#ff0000; '>(" ",100)</span>)</span>,100)</span>)</td></tr></table></td></tr></table>


For the second part, can you clarify exactly what the results should be for that sample data?
 
Last edited:
Upvote 0
Cross posted https://www.excelforum.com/excel-fo...getting-the-city-name-non-us.html#post5225512

While we do not prohibit Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules).
This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered.
 
Upvote 0

Forum statistics

Threads
1,215,431
Messages
6,124,855
Members
449,194
Latest member
HellScout

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