Remove text outside of ( )

nyrangers1994

New Member
Joined
Aug 30, 2011
Messages
17
I have an Excel Table (ListObject) that has a column called "Location" and it's in column M. It has values such as New York Metropolitan Area (New York, NY). I need a macro that looks in this column and deletes anything that isn't within the parentheses, including the parentheses themselves, such that the columns undergo these types of transformations:

1. New York Metropolitan Area (New York, NY) --> New York, NY
2. (Boston, MA) Boston Metropolitan Area --> Boston, MA
3. Philadelphia Metropolitan (Philadelphia, PA) Area --> Philadelphia, PA

Thanks for any help anyone can provide.
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Try
=REPLACE(REPLACE(A1,1,FIND("(",A1),""),FIND(")",REPLACE(A1,1,FIND("(",A1),"")),LEN(A1),"")
 
Upvote 0
Thanks for the replies, but is there a macro based approach to this?

We're extracting a daily report out of a system and to avoid paying the vendor for customizations to transform some of the data, we're attempting to create a comprehensive macro that captures all our needs where the modification to Location field is one of them. That way our operations staff can extract the daily report, run the macro against it, and everything will be formatted/transformed appropriately, without having to retype out formulas.
 
Upvote 0

Forum statistics

Threads
1,214,971
Messages
6,122,517
Members
449,088
Latest member
RandomExceller01

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