Insert brackets around values in a range
This tutorial shows how to insert brackets around all values captured in a range through the use of a & sign or VBA
="("&B5&" "&C5&" "&D5&")"
=$C$4&B8&" "&C8&" "&D8&" "&$C$5
|
GENERIC FORMULA
="("&value1&" "&value2&" "&...&")"
ARGUMENTS GENERIC FORMULA
=open_bracket&value1&" "&value2&" "&...&close_bracket
ARGUMENTS EXPLANATION This formula uses the the & sign to insert brackets between values in a range of cells.
Click on either the Hard Coded or Cell Reference button to view the formula that either has the bracket signs directly entered in the formula or referenced to a cell that captures the open and close bracket signs. |
Dim ws As Worksheet
ws.Range("E5") = "(" & ws.Range("B5") & " " & ws.Range("C5") & " " & ws.Range("D5") & ")"
End Sub
Dim ws As Worksheet
ws.Range("E8") = ws.Range("C4") & ws.Range("B8") & " " & ws.Range("C8") & " " & ws.Range("D8") & ws.Range("C5")
End Sub
Dim ws As Worksheet
'insert brackets around values in a range of cells
ws.Range("E" & x) = "(" & ws.Range("B" & x) & " " & ws.Range("C" & x) & " " & ws.Range("D" & x) & ")"
Next x
End Sub
Dim ws As Worksheet
'insert brackets around values in a range of cells
ws.Range("E" & x) = ws.Range("C4") & ws.Range("B" & x) & " " & ws.Range("C" & x) & " " & ws.Range("D" & x) & ws.Range("C5")
Next x
End Sub
Related Topic | Description | Related Topic and Description |
---|---|---|
Insert a value after each word | How to insert characters after each word through the use of an Excel formula or VBA | |
Insert brackets around value in a cell | How to insert brackets around values captured in a cell through the use of an Excel formula or VBA |