Note: The other languages of the website are Google-translated. Back to English
English English

Extract text between parentheses from text string

If there is part of the text surrounded with the parentheses within the text string, now, you need to extract all the text strings between the parentheses as following screenshot shown. How could you solve this task in Excel quickly and easily?


Extract text between parentheses from text string in Excel

To extract the data between parentheses, first, you should find the location of left and right parenthesis by using the SEARCH function, and then apply Mid Function to get the result. The generic syntax is:

=MID(text,SEARCH("(",text)+1,SEARCH(")",text)-SEARCH("(",text)-1)
  • text: The text string or cell value that you want to extract data from.

Please enter or copy the below formula into a blank cell:

=MID(A2,SEARCH("(",A2)+1,SEARCH(")",A2)-SEARCH("(",A2)-1)

Then, drag this formula to other cells that you want to apply this formula, and all texts between the parentheses have been extracted, see screenshot:


Explanation of the formula:
  • 1. SEARCH("(",A2)+1: This SEARCH function returns the position of the first left parentheses character in cell A2, and add 1 to get the position of the first character inside the parentheses. This part is recognized as the start_num argument in the MID function.
  • 2. SEARCH(")",A2)-SEARCH("(",A2)-1:
  • SEARCH(")",A2): This part of the formula returns the position of the first right parentheses character in cell A2.
  • SEARCH(")",A2)-SEARCH("(",A2)-1: The position of the right parentheses subtracts the position of the left parentheses to get the number of the characters between the parentheses that need to be extracted. And this returned value will be recognized as the num_chars argument in the MID function.
  • 3. MID(A2,SEARCH("(",A2)+1,SEARCH(")",A2)-SEARCH("(",A2)-1): So far, the MID function is used to extract the text inside the parentheses.

Note: If there are multiple parentheses in a cell, to extract all the substrings from the parentheses, you should apply the following formula:

=TRIM(MID(SUBSTITUTE(SUBSTITUTE("("&$A2,"(",")"),")",REPT(" ",LEN($A2))),2*LEN($A2)*(COLUMNS($A:A)),LEN($A2)))

Then, drag this formula to right cells to get all strings between the parentheses from a cell, see screenshot:

Keep on dragging the fill handle down to the range of cells that you want to apply this formula, and all texts between all parentheses have been extracted at once, see screenshot:


Relative functions used:

  • MID:
  • The MID function returns the specific characters from the middle of text string.
  • SEARCH:
  • The SEARCH function can help you to find the position of a specific character or substring from the given text.

More articles:

  • Extract Word Which Containing Specific Text In Excel
  • Sometimes, you may want to extract the word from a cell that contains a specific character or text, such as following screenshot shown, to extract all words that containing the “=” character. How could you solve this task in Excel?

The Best Office Productivity Tools

Kutools for Excel - Helps You To Stand Out From Crowd

Would you like to complete your daily work quickly and perfectly? Kutools for Excel brings 300 powerful advanced features (Combine workbooks, sum by color, split cell contents, convert date, and so on...) and save 80% time for you.

  • Designed for 1500 work scenarios, helps you solve 80% Excel problems.
  • Reduce thousands of keyboard and mouse clicks every day, relieve your tired eyes and hands.
  • Become an Excel expert in 3 minutes. No longer need to remember any painful formulas and VBA codes.
  • 30-day unlimited free trial. 60-day money back guarantee. Free upgrade and support for 2 years.
Ribbon of Excel (with Kutools for Excel installed)

Office Tab - Enable Tabbed Reading and Editing in Microsoft Office (include Excel)

  • One second to switch between dozens of open documents!
  • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
  • Increases your productivity by 50% when viewing and editing multiple documents.
  • Brings Efficient Tabs to Office (include Excel), Just Like Chrome, Firefox, And New Internet Explorer.
Screen Shot of Excel (with Office Tab installed)
Comments (2)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Hi there,

This was brilliant, thank you! I had tried more than 20 other formulas to remove multiple parentheses and split out the numbers contained, all without success.

Question though, this only appears to work where the cell of origin has <500 characters approx.
Any idea how I could expand this?

I am currently manually splitting the larger cells and then recombining, it only accounts for approx. 10% of my workload, but would be great if there is an automated/formulaic solution! :)

Cheers, 0
This comment was minimized by the moderator on the site
Hello,
I have tested, the second formula in this article can work well if the cell contains more than 500 characters.
=TRIM(MID(SUBSTITUTE(SUBSTITUTE("("&$A2,"(",")"),")",REPT(" ",LEN($A2))),2*LEN($A2)*(COLUMNS($A:A)),LEN($A2)))


Please have a try, if you have any other problem, please upload an error screenshot here.
Thank you!
There are no comments posted here yet
Leave your comments
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations