Skip to main content

Extract text between parentheses from text string

Author: Xiaoyang Last Modified: 2022-08-03

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

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates  |  Delete Blank Rows  |  Combine Columns or Cells without Losing Data  |  Round without Formula ...
Super VLookup: Multiple Criteria  |  Multiple Value  |  Across Multi-Sheets  |  Fuzzy Lookup...
Adv. Drop-down List: Easy Drop Down List  |  Dependent Drop Down List  |  Multi-select Drop Down List...
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  Compare Columns to Select Same & Different Cells ...
Featured Features: Grid Focus  |  Design View  |  Big Formula Bar  |  Workbook & Sheet Manager | Resource Library (Auto Text)  |  Date Picker  |  Combine Worksheets  |  Encrypt/Decrypt Cells  |  Send Emails by List  |  Super Filter  |  Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters ...)  |  50+ Chart Types (Gantt Chart ...)  |  40+ Practical Formulas (Calculate age based on birthday ...)  |  19 Insertion Tools (Insert QR Code, Insert Picture from Path ...)  |  12 Conversion Tools (Numbers to Words, Currency Conversion ...)  |  7 Merge & Split Tools (Advanced Combine Rows, Split Excel Cells ...)  |  ... and more

Kutools for Excel Boasts Over 300 Features, Ensuring That What You Need is Just A Click Away...

Description


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, Edge and Firefox.
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
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations