Remove Brackets Effectively in Excel with 5 Methods
In any Excel spreadsheet, brackets can appear in various forms, such as within cell content, formulas, or as part of data. To remove brackets in Microsoft Excel, you can use different methods depending on the context. In this article, I’m going to discuss 5 ways to remove unwanted brackets in Excel.
The dataset I’m going to use for this article consists of two columns. First, the List of Cities (With Unwanted Brackets) column contains the list of cities with the country name inside brackets. Then, the List of Cities (After Removing Brackets) column contains the list of cities after removing the brackets around the city names.
Remove Brackets in Excel Using Find and Replace
A simple way to remove brackets in Excel is by using Excel’s Find and Replace command. To demonstrate this process, I am taking only the column List of Cities from the dataset:
To remove brackets in Excel using Find and Replace command, follow these steps:
- Select your data first.
- Now, press CTRL+ F from the keyboard. The Find and Replace dialog box will open.
- At the Find what section type “(“ and keep the Replace with section blank.
I left the Replace with section empty since I want to get rid of the brackets and don’t want anything to take over their place. - Press Replace All.
You will find that all the left brackets “(“ are cleared from the dataset. - Similarly, insert “)” in the Find what box.
- Leave the Replace with box empty.
- Finally, press Replace All.
This will remove the closing parentheses “)” from the dataset.
The opening and closing brackets are searched separately because there are different words inside the brackets in the cells.
Remove Brackets in Excel Using the SUBSTITUTE Function
The SUBSTITUTE function allows you to replace occurrences of a specified substring within a given text with another substring. When dealing with brackets, you can use the nested SUBSTITUTE functions to systematically remove both opening and closing brackets, leaving you with clean text.
Syntax
=SUBSTITUTE(SUBSTITUTE(<original_text>, <text_to_replace_1>, <replacement_1>), <text_to_replace_2>, <replacement_2>)
Formula
=SUBSTITUTE(SUBSTITUTE(A2, "(", ""), ")", "")
Formula Explanation
- This formula uses two SUBSTITUTE functions to remove both opening and closing brackets from the text in cell A2.
- SUBSTITUTE(A2, “(“, “”): This replaces all occurrences of “(” (opening bracket) with an empty string in the text from cell A2.
- SUBSTITUTE(<result of inner SUBSTITUTE>, “)”, “”): This takes the result from the inner SUBSTITUTE (which is the text without opening brackets) and replaces all occurrences of “)” (closing bracket) with an empty string.
Steps to remove brackets in Excel with SUBSTITUTE function:
- First, select an empty cell.
- Then, copy and paste this formula: =SUBSTITUTE(SUBSTITUTE(A2, “(“, “”), “)”, “”)
- Press ENTER to insert the formula.
- Next, drag the Fill Handle to copy the formula to the rest of the cells.
Now, see the result. Thus, using this technique, you can remove brackets from Excel sheets.
Remove Brackets in Excel with the REPLACE and the FIND Functions
In Excel, the REPLACE function provides a direct method to eliminate particular characters like brackets from the text in cells. By employing REPLACE, you can substitute a segment of text with an empty string, effectively erasing the unwanted characters.
Syntax
=REPLACE(REPLACE(Text, FIND("(", Text), 1, ""), FIND(")", REPLACE(Text, FIND("(", Text), 1, "")), 1, "")
Formula
=REPLACE(REPLACE(A2, FIND("(", A2), 1, ""), FIND(")", REPLACE(A2, FIND("(", A2), 1, "")), 1, "")
Formula Explanation
- FIND(“(“, A2): The FIND function is used to locate the position of the opening bracket “(“ in the text of cell A2. It returns the position (character number) of the first occurrence of “(“ in the text.
- REPLACE(A2, FIND(“(“, A2), 1, “”): This part of the formula replaces the first occurrence of “(“ with an empty string in the text from cell A2.
- REPLACE(text, start, num_chars, new_text) is the syntax of the REPLACE function. In this case: text is the content of cell A2. start is the position returned by FIND(“(“, A2), indicating where the “(“ was found. num_chars is set to 1, indicating you want to replace 1 character (the opening bracket). new_text is an empty string “”, meaning you are replacing the opening bracket with nothing.
- FIND(“)”, REPLACE(A2, FIND(“(“, A2), 1, “”)): This part of the formula locates the position of the closing bracket “)” in the text after removing the opening bracket using the REPLACE function from the previous step.
- REPLACE(…, FIND(“)”, REPLACE(A2, FIND(“(“, A2), 1, “”)), 1, “”): Similar to the first REPLACE, this part replaces the first occurrence of “)” with an empty string in the text after removing the opening bracket. The start position is the result of FIND(“)”, REPLACE(A2, FIND(“(“, A2), 1, “”)), which gives the position of the first closing bracket.
Steps to remove brackets in Excel with the REPLACE and the FIND functions:
- Select a cell.
- Copy this formula: =REPLACE(REPLACE(A2, FIND(“(“, A2), 1, “”), FIND(“)”, REPLACE(A2, FIND(“(“, A2), 1, “”)), 1, “”)
- Now, paste it into the selected cell.
- Press ENTER to insert the formula.
- Next, drag the Fill Handle to copy the formula from cell range B2:B10.
This is another way to remove brackets in Excel using the REPLACE and FIND functions. See the final result here:
Remove Brackets in Excel Using the CLEAN Function
If you have text data containing brackets that you need to eliminate, combining the CLEAN function with the SUBSTITUTE function provides a straightforward way to achieve this.
Syntax
=CLEAN(SUBSTITUTE(SUBSTITUTE(TargetCell, "(", ""), ")", ""))
Formula
=CLEAN(SUBSTITUTE(SUBSTITUTE(A2, "(", ""), ")", ""))
Formula Explanation
If your text is in cell A2, this formula aims to remove both opening and closing brackets from the text while also removing any non-printable characters that might be left.
- SUBSTITUTE(A2, “(“, “”): The innermost SUBSTITUTE function removes all occurrences of “(” (opening bracket) from the text in cell A2 by replacing them with an empty string.
- SUBSTITUTE(<result of inner SUBSTITUTE>, “)”, “”): The result from the inner SUBSTITUTE is used as the text for this second SUBSTITUTE function. This function replaces all occurrences of “)” (closing bracket) with an empty string, further cleaning the text from any closing brackets.
- CLEAN(…): The CLEAN function takes the result from the second SUBSTITUTE as its input.
Follow these steps to remove brackets with the CLEAN function:
- First, select an empty cell.
- Copy the formula: =CLEAN(SUBSTITUTE(SUBSTITUTE(A2, “(“, “”), “)”, “”))
- Paste the formula into the cell.
- Press ENTER to insert the formula.
- Next, drag the Fill Handle to copy the formula to the rest of the cells.
Here’s the final result after removing the brackets in Excel.
Clear Brackets in Excel Using VBA
VBA is the short form of Visual Basic for Applications. I am creating a custom VBA function to remove brackets from a given dataset. The number and types of brackets can be different in the cells. To show you the variation in the text strings, I am using a slightly different dataset here:
Go through these steps with a VBA code to remove brackets:
- Press Alt + F11 to open the VBA editor within Excel.
- In the Visual Basic Editor, click Insert > Module to insert a new module.
- Copy and paste the following VBA code into the module window:
Sub KeepTextWithoutBrackets() Dim InputRange As Range Dim OutputCell As Range Dim Cell As Range Dim TempStr As String Dim i As Integer ' Prompt the user to select the range On Error Resume Next Set InputRange = Application.InputBox("Select a range containing text:", Type:=8) On Error GoTo 0 If InputRange Is Nothing Then Exit Sub End If ' Prompt the user to select the starting cell for output On Error Resume Next Set OutputCell = Application.InputBox("Select a starting cell for the output:", Type:=8) On Error GoTo 0 If OutputCell Is Nothing Then Exit Sub End If ' Loop through each cell in the selected range For Each Cell In InputRange TempStr = "" ' Loop through each character in the cell value For i = 1 To Len(Cell.Value) If InStr("(){}[]", Mid(Cell.Value, i, 1)) = 0 Then ' Append the character to TempStr if it's not a bracket TempStr = TempStr & Mid(Cell.Value, i, 1) End If Next i ' Output the modified text (without brackets) in the corresponding cell OutputCell.Value = TempStr Set OutputCell = OutputCell.Offset(1, 0) Next Cell End Sub
- Press the F5 key on the keyboard.
It will run the code. Alternatively, you can select the Run command.
The Input dialog box will pop up for the input range. - Manually type the cell range $A$2:$A$10 or select it from the worksheet.
- Hit OK.
- To display the output, insert the first cell of the output column, B2 or $B$2.
- Click on the OK button.
Now close the VBA interface.
Here are the final output. In this way, you can get the filtered dataset where the brackets are removed.
Conclusion
In conclusion, there are several ways to remove brackets in Microsoft Excel. Depending on your data type and your needs, you can select the method that works best for you. If your dataset contains different types of brackets, the methods mentioned in this article will work for you.
Happy Excelling!
Frequently Asked Questions
How do I remove text before brackets in Excel?
To remove text before brackets in Excel, follow these steps:
- Select the cells containing the text you want to remove.
- Press CTRL + H to open the Find and Replace dialog.
- In the Find what box, type an asterisk (*) followed by an opening bracket such as “*[“.
- Leave the Replace with box empty.
- Finally, press Replace All.
This method allows you to efficiently delete text before brackets in Excel cells.
How to remove parentheses from phone numbers in Excel?
To remove parentheses from phone numbers in Excel, use the “Find and Replace” feature:
- Select the cells containing the phone numbers.
- Press CTRL + H to open the Find and Replace dialog.
- In the Find what box, type an opening parenthesis “(“.
- Leave the Replace with box empty.
- Click Replace All.
This process will swiftly eliminate the parentheses from your phone numbers in Excel.