Need to put text in brackets

Microsoft Excel 2003 (full product)
December 25, 2009 at 01:49:49
Specs: Windows XP
I am trying to change a phrase or word in a cell by indicating its change from another cell.
e.g a1 has the word dog chain typed in and in cell a4 i want to indicate if I want this word with a YES or No. So If I type NO it will change the cell a1 to [dog chain]
if i type YES it will change the cell to "dog chain"
Basically I want to be able to put these brackets around words in a column by changing the word in another column
Is there a simple way to do this

See More: Need to put text in brackets

Report •

December 25, 2009 at 06:33:48

Try this:
Put your words (without brackets or quotes) in column H, starting in cell H1
Put "" in cell G1
Put [] in cell G2

Cell B1 contains Yes or No

In cell A1 put this formula:=IF($B$1="Yes",LEFT($G$1,1)&H1&RIGHT($G$1,1),LEFT($G$2,1)&H1&RIGHT($G$2,1))
Note the $ signs in some parts of the formula
Extend the formula in A1 by dragging it down as many rows as you have words in column H.

Cell B1 could be controlled using data validation, so that only "Yes" or "No" can be entered.
Put Yes in F1 and No in F2
Select B1, from the menu select Data - Validation ...
Under the 'Settings' Tab select List from the 'Allow:' box.
Then in the 'Source:' box, select cells F1 to F2
Click OK
Now select Cell B1 and it will have a drop-down with Yes and No in it.


Report •

December 25, 2009 at 07:55:58

=IF(B3="Yes","["&A3&"]",IF(B3="No",""""&A3&"""","B3 Must be Yes or No"))

Note the 4 double quotes for the No portion of the formula. I tested the formula on Open Office 3 which requires the ".

IIRC Excel needs the extra " also.

Report •

December 25, 2009 at 19:48:28
Thanks for such quick replies.
I have added the formula from DerbyDad03 and it works perfectly

Thanks again

Report •

Related Solutions

Ask Question