## Remove text within parentheses or brackets from text strings

Supposing, you have a list of text strings, and part of the texts are enclosed in the parentheses, now, you want to remove all texts within the parentheses and including the parentheses themselves as below screenshot shown. This article, I will introduce some methods for solving this task in Excel.

**Remove text within parentheses or brackets from text strings with formula****Remove text within parentheses or brackets from text strings with User Defined Function**

** Remove text within parentheses or brackets from text strings with formula**

You can create a formula based on the SUBSTITUTE, MID FIND and LEN functions for dealing with this job, the generic syntax is:

**=SUBSTITUTE(text,MID(LEFT(text,FIND(")",text)),FIND("(",text),LEN(text)),"")**

**text**: The text string or cell reference that you wan to use.

Please copy or enter the following d=formula into a blank cell where you want to get the result:

**=SUBSTITUTE(A2,MID(LEFT(A2,FIND(")",A2)),FIND("(",A2),LEN(A2)),"")**

And then, drag the fill handle down to the cells you want to apply this formula, and all texts within the parentheses including the parentheses have been removed, see screenshot:

##### Explanation of the formula:

**1. MID(LEFT(A2,FIND(")",A2)),FIND("(",A2),LEN(A2)):** This MID function is recognized as the old¬¬_text argument within the SUBSTITUTE function.

**LEFT(A2,FIND(")",A2))**: This part of the formula is used to extract the text string from left to the right parenthesis in cell A2, and you will get the result as this: “Tom Hill (Houston Texas)”. This will be recognized as the text argument within the MID function.**FIND("(",A2)**: This FIND function will return the position of the left parenthesis from cell A2, the result is: 10. And this part formula is recognized as the start_num argument within the MID function.**LEN(A2)**: The LEN function will get the total number of the characters in cell A2, and the result is: 27. This part is recognized as the num_chars argument of the MID function.**MID(LEFT(A2,FIND(")",A2)),FIND("(",A2),LEN(A2))= MID("Tom Hill (Houston Texas)",10,27)**: This MID function is used to extract the characters from the text string which are returned by the LEFT function, start from the tenth character with a length of 27 characters, and you will get the result as this: “(Houston Texas)”.

**2. SUBSTITUTE(A2,MID(LEFT(A2,FIND(")",A2)),FIND("(",A2),LEN(A2)),"")= SUBSTITUTE(A2, "(Houston Texas)",""):** At last, this SUBSTITUTE function is used to replace the old text that returned by the MID function with nothing in the text string of cell A2.

##### Notes:

1. If the part of text enclosed with the brackets, you just need to replace the parentheses with the brackets as below formula:

**=SUBSTITUTE(A2,MID(LEFT(A2,FIND("]",A2)),FIND("[",A2),LEN(A2)),"")**

2. If there is no parentheses in the cell value, after applying the above formula, an error will be displayed, in this case, you just need to enclose the above formula into the IFERROR function:

**=IFERROR(SUBSTITUTE(A2,MID(LEFT(A2,FIND(")",A2)),FIND("(",A2),LEN(A2)),""),A2)**

** Remove text within parentheses or brackets from text strings with User Defined Function**

If there are two or more parentheses within the text string, the above formula only can be used to remove text in the first parentheses. To remove all texts in multiple parentheses as the following screenshot shown, how could you achieve it in Excel?

In this case, a User Defined Function can help you to remove all texts in the parentheses. Please do with the following steps:

**1**. Hold down the **Alt + F11** keys in Excel, and it opens the **Microsoft Visual Basic for Applications** window.

**2**. Click **Insert** > **Module**, and paste the following VBA code in the Module Window.

Function remtxt(ByVal str As String) As String 'updateby Extendoffice While InStr(str, "(") > 0 And InStr(str, ")") > InStr(str, "(") str = Left(str, InStr(str, "(") - 1) & Mid(str, InStr(str, ")") + 1) Wend remtxt = Trim(str) End Function

**3**. Then, go back to the worksheet where you want to use, and enter this formula into a blank cell: **=remtxt(A2)**, then drag the fill handle down to the cells you want to apply this formula, all the texts within the multiple parentheses including the parentheses have been removed at once, see screenshot:

** Relative functions used:**

**LEN:**- The LEN function returns the number of characters in a text string.

**MID:**- The MID function is used to find and return a specific number of characters from the middle of given text string.

**FIND:**- The FIND function is used to find a string within another string, and returns the starting position of the string inside another one.

**SUBSTITUTE:**- The Excel SUBSTITUTE function replaces text or characters within a text string with another text or characters.

** More articles:**

**Remove Text Before Or After First Or Last Specific Character From Text Strings**- This tutorial will talk about how to remove the text before or after the first or last specific character, such as space, comma from a list of text strings in Excel.

**Strip Or Remove Non-Numeric Characters From Text Strings**- Sometimes, you may need to remove all of the non-numeric characters from the text strings, and only keep the numbers as below screenshot shown. This article will introduce some formulas for solving this task in Excel.

**Strip Or Remove Numeric Characters From Text Strings**- If you want to remove all numbers only from a list of text strings but keep other non-numeric characters, maybe there are some formulas in Excel can do you a favor.

**Remove Text From A Cell Based On Specific Position**- This tutorial explains how to use formulas to remove text from a cell based on specific position 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.

#### 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.

###### You are guest ( Sign Up? )

###### or post as a guest, but your post won't be published automatically.

Be the first to comment.