Turning green

B

bollard

On a spreadsheet we have a column which simply has the answer Yes or No.

In a row where the answer in that column is "Yes", I'd like the first 2
columns to turn green.

Any ideas, please?

Thanks.
 
S

Susan

try this:

say you're in cell c2
somewhere in your spreadsheet, put the words "Yes" and "No" (without
quotes) & change them to white text OR hide the column. note the
location of these 2 words. in my sample i put them in T1 & T2.

select a2:b2
format, conditional formatting
choose "formula is" and enter
=$C2=$T$1
and choose the shading formatting
then click "add"
choose "formula is" again and enter
=$C2=$T$2
and choose "no fill" shading formatting
hit ok

try it out

if it works, highlight a2:b2 & drag down formatting as low as you
want. check one cell by opening conditional formatting again & make
sure the row # changed as you dragged it down.
:)
susan
 
B

bollard

Hi Susan.

I don't understand what you mean.

Let me clarify what's where:

The applicant's name appears in A2 and B2. The Yes/No data is in column M.

Surely I can use an IF condition, which includes $M$2="Yes" somewhere?
 
W

William Horton

Highlight cells A2 and B2. Follow the Excel menu path Format / Conditional
Formatting. Change the first drop down field to "Formula Is." Then enter
the formula =$M2="Yes" in the next field. Then click on the Format button
and set the format to what you want the cell to be if the value is Yes. Then
click on Okay until you are back to Excel. A2 and B2 should now be whatever
format you set if the value in $M2 = Yes. Use the format painter to copy
this format to whatever other cells you want.

Hope that helps.
 
W

William Horton

It's working for me on my Excel (Excel 2003). Go back into Format /
Conditional Formattingt and recheck the formula. Ensure that it is exactly
as I posted before. Sometimes Excel adds quotes by mistake and I have to go
back in and delete them.

Try that.
 
B

bollard

Hi William

No, I've checked and there's just the one set of inverted commas. It isn't
working. I've tried formatting column M so that the Yes and No are treated as
general, or as text etc and nothing seems to make any difference.
 
W

William Horton

Inverted commas??? Make sure there are quotes " around the word Yes. Also,
did you remember to set a format if your condition is true? And if so is it
a format that you would be able to differentiate from the regular formula?
Recheck your conditional format.

You may also try practicing in another blank worksheet. Try with the simple
conditional formatting of cell value equals and once you get that to work
move on from there to the Formula Is option.

I set my spreadsheet up with names in A2 and B2 and the word Yes in M2.
Then when I put the conditional formula Formula Is =$M2="Yes" in cells A2 and
B2 and then set the conditional format for those cells to a font color of
green it works. When the word Yes is in M2 the cells turn green and when it
is anything else they go back to normal font.

There must be something small you are missing.
 
B

bollard

Hi William

Inverted commas = quotes, sorry!

I'll try it in another sheet. At one point I tried placing an apostrophe
before the words yes and No in the bar at the top of the page and that
appeared to work at fiurst, but then it didn't work next time.

The spreadhseet was originally set up from a CSV file. I'm not sure if that
is messing things up. I may try sending the sheet home and importing it
afresh into Excel and trying from there. It seems such a stupidly simple
thing, yet it's proving so stubborn!
 
D

David Biddulph

Make sure you haven't got spare spaces or other non-printing characters in
M2.
Does =LEN(M2) give you the answer 3?

Also double check that you've got "Formula Is" in your CF, not "Cell value
is".
 
B

bollard

Hi David

That's very interesting!

When I run the LEN formula, every No shows up as 3 and every Yes as 4.

What can I do to overcome this?
 
W

William Horton

Oh, that must be why it isn't working. There must be a space before or after
your Yes and No in column M. If you fix that the conditional format should
work.

Or you could adjust the conditional format to be " Yes" or "Yes " depending
on where the space is in column M.

Hopefully that will do it.
 
S

Susan

Oh, that must be why it isn't working.
There must be a space before or after your Yes
and No in column M. If you fix that the
conditional format should work.

william -
great idea - i never would have thought to check that as to why it
wouldn't work.
i'll keep it in mind for the future.
:)
susan
 
D

David Biddulph

You may get somewhere with functions like TRIM and CLEAN, but if your
spurious extra character is consistently at one end or the other of the
string you might use =LEFT(A1,LEN(A1)-1) or =RIGHT(A1,LEN(A1)-1) as
applicable.
 
B

bollard

Many thanks David. Very helpful.

David Biddulph said:
You may get somewhere with functions like TRIM and CLEAN, but if your
spurious extra character is consistently at one end or the other of the
string you might use =LEFT(A1,LEN(A1)-1) or =RIGHT(A1,LEN(A1)-1) as
applicable.
 
Top