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

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
59,294
Office Version
  1. 365
Platform
  1. Windows
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

Parre

New Member
Joined
Feb 25, 2009
Messages
6
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

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
59,294
Office Version
  1. 365
Platform
  1. Windows
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,190,677
Messages
5,982,216
Members
439,769
Latest member
trungminh2802

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
Top