Conditional Formatting With Options

  • Thread starter Thread starter aussiem
  • Start date Start date
A

aussiem

Is there a way to color the background of a cell with a number of
possibilites?

For example, if the value of a different cell is less than 2, then the cell
I am dealing with should be green. If the other cell's value is 2, then this
cell should be pink. And if the other cell's value is 3, then this cell
should be blue.

Thanks in advance.
 
Assume you want to colour of B1 to vary depending on the value in A1
and the criteria [slightly tweaked tighter from what you posted] is:
a. A1 < 2 [ and A1 isn't blank, as blanks = zeroes] - Light green
b. A1 = 2 - Pink
c. A1 > 2 - Blue [instead of A1 = 3]

Select B1

Click Format > Conditional Formatting [ CF ]

For Condition 1, put:
Fornula Is | =AND(NOT(ISBLANK(A1)),A1<2)
Click Format button > Patterns tab > Light green > OK

Click Add >>
(This adds condition 2)

For Condition 2, put:
Fornula Is | =A1=2
Click Format button > Patterns tab > Pink > OK

Click Add >>
(This adds condition 3)

For Condition 3, put:
Fornula Is | =A1>2
Click Format button > Patterns tab > Blue > OK

Click OK at the main CF dialog

----
To propagate the CF to other cells in a relative manner,
you can use the Format painter

Select B1

Double-click Format Painter icon
[ cursor will turn into a "brush" ]

Now just click on the other cells as desired
to "paint" / copy the CF

For example, paint on B2 down to say B5
The CF will be applied relatively, i.e. colour in B2:B5
will be dependent on values in A2:A5

Press Esc when done to revert cursor to normal
----

If you have more than 3 conditions to format, you'd probably need a macro

Here's the links to 2 recent posts by Dave Peterson & Bob Phillips
which illustrates how
a. http://tinyurl.com/3cex5 [by Dave Peterson]
b. http://tinyurl.com/2apja [by Bob Phillips]

Check out also JE McGimpsey's page at:
http://www.mcgimpsey.com/excel/conditional6.html
which also contains links to Dave McRitchie's & Chip Pearson's CF pages
 
Thanks. I'm still having some problems, but I think that's because Excel is
computing values to too many decimal places for my criteria to be correct.


Max said:
Assume you want to colour of B1 to vary depending on the value in A1
and the criteria [slightly tweaked tighter from what you posted] is:
a. A1 < 2 [ and A1 isn't blank, as blanks = zeroes] - Light green
b. A1 = 2 - Pink
c. A1 > 2 - Blue [instead of A1 = 3]

Select B1

Click Format > Conditional Formatting [ CF ]

For Condition 1, put:
Fornula Is | =AND(NOT(ISBLANK(A1)),A1<2)
Click Format button > Patterns tab > Light green > OK

Click Add >>
(This adds condition 2)

For Condition 2, put:
Fornula Is | =A1=2
Click Format button > Patterns tab > Pink > OK

Click Add >>
(This adds condition 3)

For Condition 3, put:
Fornula Is | =A1>2
Click Format button > Patterns tab > Blue > OK

Click OK at the main CF dialog

----
To propagate the CF to other cells in a relative manner,
you can use the Format painter

Select B1

Double-click Format Painter icon
[ cursor will turn into a "brush" ]

Now just click on the other cells as desired
to "paint" / copy the CF

For example, paint on B2 down to say B5
The CF will be applied relatively, i.e. colour in B2:B5
will be dependent on values in A2:A5

Press Esc when done to revert cursor to normal
----

If you have more than 3 conditions to format, you'd probably need a macro

Here's the links to 2 recent posts by Dave Peterson & Bob Phillips
which illustrates how
a. http://tinyurl.com/3cex5 [by Dave Peterson]
b. http://tinyurl.com/2apja [by Bob Phillips]

Check out also JE McGimpsey's page at:
http://www.mcgimpsey.com/excel/conditional6.html
which also contains links to Dave McRitchie's & Chip Pearson's CF pages

--
Rgds
Max
xl 97
---
Please respond, in newsgroup
xdemechanik <at>yahoo<dot>com
----
aussiem said:
Is there a way to color the background of a cell with a number of
possibilites?

For example, if the value of a different cell is less than 2, then the cell
I am dealing with should be green. If the other cell's value is 2, then this
cell should be pink. And if the other cell's value is 3, then this cell
should be blue.

Thanks in advance.
 
Back
Top