Excel Guides

Adding a Missing Closing Bracket in Excel

If you're missing a closing bracket in Excel, there are a few ways to add one. One way is to use the Find and Replace feature. To do this, press Ctrl+F to open the Find and Replace dialog box. In the Find what field, type the opening bracket ([) and then click the Replace All button. This will replace all of the opening brackets with closing brackets (]).

Another way to add a closing bracket is to use the AutoCorrect feature. To do this, open the AutoCorrect dialog box by going to File > Options > Proofing. Under AutoCorrect options, make sure that the Replace text as you type checkbox is selected. Then, in the Replace field, type an opening bracket ([) and in the With field, type a closing bracket (]). Click Add and then OK.

You can also add a closing bracket by typing it directly into the cell. To do this, press Alt+F11 to open the Visual Basic Editor. In the editor, go to Insert > Module. In the module, type the following code:

Function AddBracket(str As String) As String
  If Right(str, 1) <> "]" Then str = str & "]"
  AddBracket = str
End Function

This code will check if the last character in a cell is not a closing bracket. If it's not, it will add one. To use this code, select the cells that you want to add closing brackets to and then run the macro by going to Run > Run Sub/UserForm.

Move beyond 

Excel

Get started with Causal today.
Build models effortlessly, connect them directly to your data, and share them with interactive dashboards and beautiful visuals.