I have a column in Excel that I want to enclose the contents with brackets in every cell. Is there an easy way to do that? Thanks
I have a column in Excel that I want to enclose the contents with brackets in every cell. Is there an easy way to do that? Thanks
Insert a column tothe left (assuming stuff is in A). In B1 ="("&A1&")". Copy down column. Select all of B; Copy followed by Edit|Paste Special -> Values. Now you can delete column A.
If you just want the brackets to appear you can use Format - Cells - Number - Custom: "["General"]";"["General"]";"["General"]";"["@"]". Paste it in from this post. If you have numbers that require specific number formatting, replace the word General with any number format you want. The first is for positive numbers, then negative, then zero. The last part, "["@"]" , is for text. If you want to actually put the brackets into the cells, it will require a formula in another cell, which could be pasted back over the original stuff to make the brackets permanent in your original cells. The formula used depends on what you have in the cells, numbers or text. If any of the original cells are formulas, they'll have to be modified to include the brackets; don't use this method, though you can use the first.
You could enter the following formula in the column next to it ="(" & A1 &")". Alternatively you could select the cells and run the macro given below :
Code:Sub Test() Dim cell As Range For Each cell In Selection cell.Value = "(" & cell.Value & ")" Next cell End Sub
Bookmarks