How to match the content within a ()

yichuansancun

Board Regular
Joined
Feb 7, 2011
Messages
123
I have the following table

India (Bangalore)
India (Mumbai)
China (Shanghai)
China (Beijing)
USA (San Francisco)

My lookup value will only be the city, ie the part that is within the (). How can I use match function to return the row number?

For example, I want to know the row number of text string that contain Shanghai. Will that be:

=MATCH(LEFT(C9,SEARCH("(",C9,2)),$Z$2:$Z$2198,0)

?

Thanks,
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
I have the following table

India (Bangalore)
India (Mumbai)
China (Shanghai)
China (Beijing)
USA (San Francisco)

My lookup value will only be the city, ie the part that is within the (). How can I use match function to return the row number?

For example, I want to know the row number of text string that contain Shanghai. Will that be:

=MATCH(LEFT(C9,SEARCH("(",C9,2)),$Z$2:$Z$2198,0)

?

Thanks,
Maybe something like this...

AC2 = Shanghai

=MATCH("*"&AC2&"*",Z:Z,0)
 
Upvote 0
This will return the city name

Excel Workbook
AB
1India (Bangalore)Bangalore
2India (Mumbai)Mumbai
3China (Shanghai)Shanghai
4China (Beijing)Beijing
5USA (San Francisco)San Francisco
Sheet3
 
Upvote 0
Awesome!!!! Thank you!!!! :biggrin::rofl:
Can't tell who you're replying to.

If you did want to extract just the city name here's another way:

Book1
ZAA
2India (Bangalore)Bangalore
3India (Mumbai)Mumbai
4China (Shanghai)Shanghai
5China (Beijing)Beijing
6USA (San Francisco)San Francisco
Sheet1

Formula entered in AA2 and copied down:

=SUBSTITUTE(MID(Z2,FIND("(",Z2)+1,50),")","")
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,289
Members
452,902
Latest member
Knuddeluff

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