How to Add Parentheses Around Text in Excel

Sometimes, when working with text data in Excel, you may want to add parentheses around the text in a cell or range of cells.

For example, below, I have a data set with the region name in column A, and I want to put these names in parentheses or brackets.

Data set where I want to add Parentheses around text in Excel

As always, Excel offers multiple ways to do this easily.

In this article, I will show you four different methods you can use to quickly add parentheses around text in a range of cells in Excel.

Add Parentheses Around Text Using Flash Fill

The fastest way to quickly add parentheses in cells is by using Flash Fill.

Flash Fill works by identifying patterns based on the result that you manually enter in one or two cells and then use it to fill the entire column following the same pattern.

Let me show you how it works.

Below is the data set where I have country names in column A, and I want to add parentheses around these names.

Data set to add parentheses around text Excel

Here are the steps to do this using Flash Fill:

  1. In cell B2, manually enter the result that you expect (which would be (US) in this case)
Enter the expected result in the first cell
  1. Now, hold the Control key and press the E key. This is the keyboard shortcut to run Flash Fill, which would fill the entire column based on the pattern that it has identified in cell B2.
Use flash fill to fill the entire column with the result

If you don’t want to remember a new keyboard shortcut, you can also run Flash Fill by going to the Home tab, clicking on the Fill option, and then clicking on Flash Fill.

Click the flash fill option in the ribbon

Note that the result you get with this method is not dynamic. So, if your original data in the column changes, the result will not automatically update, and you’ll have to use Flash Fill again to get the updated results.

In some cases, it’s possible that Flash Fill may not be able to recognize the pattern correctly. In such cases, you can enter the expected result manually in two or three cells and then try using Flash Fill.

Also read: Remove Parentheses in Excel

Add Parentheses Around Text Using Formula

You can also use a simple concatenate formula to quickly add parentheses around text in a range of cells.

Below, I have the same data set where I have country names in column A, and I want to get these names within parentheses.

Data set to add parentheses around text Excel

Here is the formula that will do this:

="("&A2&")"

Enter this formula in cell B2, then hit enter, and then copy the formula down for all the cells to get the results.

Formula to add parentheses around text

If your version of Excel has dynamic arrays, then you can also use the following formula (with no need to copy down the formula as it automatically sills and fills the entire range):

="("&A2:A7&")"
Dynamic array formula to add parentheses around text

One advantage of using this formula method is that your result is dynamic. So, if the original data in column A changes, the result in Column B will automatically update

Add Parentheses Around Text Using Custom Cell Formatting

One smart technique to add parentheses around text without changing the actual text in the cell is by using custom cell formatting.

With this method, we change the cell format so that it shows you the parentheses around the cell content, but it doesn’t actually add them to the cell.

Let me show you how it works.

Below is the data set where I have country names in column A, and I want to display these country names within parentheses.

Data set to add parentheses around text Excel

Here are the steps to do this using custom cell formatting:

  1. Select the range of cells to which you want to add parentheses
  2. Hold the Control key and then press the 1 key. This will open the Format Cells dialog box. Alternatively, you can also click on the Home tab and then click on the dialog box launcher in the Number group.
Click on the dialog box launcher in the home tab in number group
  1. In the Number tab, click on the Custom option
Select the custom option in the number tab in format cells dialog box
  1. Enter the following format in the Type field:
"("@")"
Enter the custom formatting in the type field to add parentheses around text
  1. Click ok

As soon as you click ok in step 5, you will notice that an opening and closing parenthesis have been added around the cell content in the selected range.

Custom formatting added brackets around text

But if you select any of these cells, you will notice that in the formula bar, it shows you the cell values without parentheses.

Formula bar does not show the parentheses

Unlike the other methods covered above, in this method, you do not need an additional column to get the result. Also, if you change the content of any cell to which this format has been applied, it will automatically update and put the new cell content within brackets.

Also read: Display Negative Numbers in Parentheses

Add Parentheses Around Text Using VBA

If adding parentheses around the text is something you need to do quite often, you can also consider creating a VBA macro script and adding it to your workbook (or personal macro workbook).

Below is the VBA code that adds an opening and closing parenthesis to the cells in the selected range:

'Code by Sumit Bansal from Trumpexcel.com
Sub AddParnetheses()
For Each cell In Selection
cell.Value = "(" & cell & ")"
Next cell
End Sub

The above VBA code uses a For Each Next loop to go through each cell in the selection and add an opening and closing parenthesis around the cell content

Here are the steps to use this macro code:

  1. Press Alt + F11 on your keyboard (or click the Developer tab and then click on the Visual Basic icon). This will open the Visual Basic for Applications (VBA) editor.
Click on visual basic option in the ribbon
  1. In the Visual Basic Editor, click on the Insert option in the menu and then click on Module. This will insert a new module for that workbook.
Insert module in the VB Editor
  1. Copy and paste the above VBA code into the Module code window. If the module code window is not open or you have closed it accidentally, double-click on the module object in the Project Explorer, and it will reopen the module code window.
Copy paste the macro code in the module to add brackets
  1. Now, to run the macro code, Place the cursor anywhere in the code and press the F5 key, or click on the run macro icon in the toolbar.
Run the macro to add parentheses
  1. Close the VB Editor.

Once you have the code in the workbook, you can reuse it by clicking on the Developer tab, clicking on the Macros button, and then selecting the macro and clicking the Run button.

Important Note: Remember that any changes that are done by a vb macro cannot be undone. So, I strongly suggest you create a backup copy of your data set just in case you need the original data set back.

If you want to reuse the macro in the workbook, ensure that you save it as a macro-enabled file (with .XLSM extension). This option appears in the Save As dialog box when saving the file.

So, these are four methods that you can use to quickly add parentheses around text in a cell or range of cells in Excel.

I’ve also created a table below that briefly summarizes each method along with some of the important things you need to know.

Method Pros Cons
Using Flash Fill Quick and Easy The result is static. Flash Fill may recognize a wrong pattern sometimes
Using Formula Result is dynamic, so it updates if you change the original dataset
Using Cell Formatting Parentheses are not actually added (but only displayed in the cell. Result is dynamic. More complicated than other methods
Using VBA Useful when you need to repeat this often Needs some setting up

I hope you found this Excel article helpful. Do let me know your thoughts while leaving a comment below.

Other Excel articles you may also like:

source

Leave a Comment