Extracting content from cell with multiple parentheses

Don Iliffe

New Member
Joined
Dec 18, 2008
Messages
15
I am looking for a formula expression that will let me extract from a cell that contains multiple parentheses to another cell ,specifically in the 2nd instance of parentheses.

The cell content looks like this;
OC (77G201)(A4T201)
OC (ITPN)(GTHS)

As you can see the cell content length can vary.

I can extract from the first instance of parentheses using =mid/find. But I can not figure out how to do a separate extract from the second instance.

Any ideas anyone?
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Re: Extracting content from cell with multiple paretheses

DO two finds nested in each other and then remove the closing backet:
Code:
=SUBSTITUTE(MID(A1,FIND("(",A1,FIND("(",A1)+1)+1,LEN(A1)),")","")
 
Upvote 0
Re: Extracting content from cell with multiple paretheses

Something like this can help do both:

=TRIM(MID(SUBSTITUTE(SUBSTITUTE($A1,")",REPT(" ",99),COLUMNS($A$1:A1)),"(",REPT(" ",99),COLUMNS($A$1:A1)),99,99))

Drag across and down.
 
Upvote 0
Re: Extracting content from cell with multiple paretheses

Thanks for quick response.
Tried that but getting an error, Too many arguments.
 
Upvote 0
Re: Extracting content from cell with multiple paretheses

The =TRIM formula is only giving me the content of the first parentheses instance and not the second instance which desired
 
Upvote 0
Re: Extracting content from cell with multiple paretheses

The =TRIM formula is only giving me the content of the first parentheses instance and not the second instance which desired


Thats because you didnt follow the drag across and down part.
 
Upvote 0
Re: Extracting content from cell with multiple paretheses

ERR, Whoops!
It is working fine thanks.
Note to self, read the d**n instructions

May thanks,
 
Upvote 0
Re: Extracting content from cell with multiple paretheses

Hi,

Here's another formula that'll work and is more robust against Column(s) insertions.

Formula copied down and across:


Book1
ABCD
1OC (77G201)(A4T201)77G201A4T201
2OC (ITPN)(GTHS)ITPNGTHS
3OC (ITPN)(GTHS)(ABCD)ITPNGTHSABCD
Sheet488
Cell Formulas
RangeFormula
B1=TRIM(MID(SUBSTITUTE(SUBSTITUTE($A1,")",""),"(",REPT(" ",99)),COLUMNS($B1:B1)*99,99))
 
Last edited:
Upvote 0
Re: Extracting content from cell with multiple paretheses

Many thanks for that, another for library 'O' stuff
 
Upvote 0
Re: Extracting content from cell with multiple paretheses

You're welcome.
 
Upvote 0

Forum statistics

Threads
1,223,907
Messages
6,175,300
Members
452,633
Latest member
DougMo

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