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:
- 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:
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:
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:
- The MID function returns the specific characters from the middle of text string.
- The SEARCH function can help you to find the position of a specific character or substring from the given text.
- Extract Word Beginning With A Specific Character In Excel
- For example, you may need to extract the word which begins with a specific character “=” for each cell as below screenshot shown, how could you solve this task quickly and easily in Excel?
- 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?