Extract text in last paranthesis

Parre

New Member
Joined
Feb 25, 2009
Messages
6
Hi.

I'm trying to extract a number formatted as text from within paranthesis.

The text is formatted like this:
"textexample (11-2222-33)"

I'm using the formula:
=SUBSTITUTE(MID(B1;FIND("(";B1)+1;255);")";"")

The output is "11-2222-33" as expected but some of the cells contains two paranthesis as following:

"textexample (aa) (11-2222-33)"

My formula outputs:
"aa (11-2222-33"

How can i modify the formula to take an extra pair of paranthesis in consideration and make the output the same as in the first example?

/Parre
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Is the text of interest always at the right and/or always 10 characters in length?

Would either of these work for you?

=MID(A1,LEN(A1)-10,10)

=TRIM(RIGHT(SUBSTITUTE(LEFT(A1,LEN(A1)-1),"(",REPT(" ",100)),100))
 
Upvote 0
The text is always at the right, but sometimes there is a "space" between the last number and the last paranthesis that also has to be removed.

exampletxt (11-2222-33 )


Andrews formula and your second formula corrects for this.

/Parre
 
Upvote 0
The text is always at the right, but sometimes there is a "space" between the last number and the last paranthesis that also has to be removed.

exampletxt (11-2222-33 )
In that case, and if the number of characters is always 10, then this might do:

=MID(A1,LEN(A1)-10-(RIGHT(A1,2)=" )"),10)
 
Upvote 0

Forum statistics

Threads
1,214,386
Messages
6,119,217
Members
448,876
Latest member
Solitario

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