Excel Conditional Formatting VBA

Closed
ross_jeremy Posts 2 Registration date Friday September 23, 2011 Status Member Last seen September 26, 2011 - Sep 23, 2011 at 06:20 PM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Sep 27, 2011 at 09:13 AM
I am trying to format excel to do the following

If A1 is "Bad" B1 to G1 Cell color is Grey
If A1 is "Good" B1 to G1 Cell color is Green
If D1 is greater than .7999 cell color is red
If D1 is less than 4.5555 cell color is red
If D1 is neither less than or greater than the above it will follow the cell color if A1 is "bad" or "good"
If A2 is "Good" B3 to G1 Cell color is blue

The conditional formatting will go all the way down the sheet

Thank you

Jeremy


Related:

3 responses

venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 811
Sep 23, 2011 at 08:55 PM
if your version of excel is 2003 or earlier you cannot have more than three conditions for conditional formatting. in 2007 you can have more. which is your version.
0
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 552
Sep 26, 2011 at 09:04 AM
Hi ross_jeremy,

So for example:
If A1 = "Bad" then D1 color is grey.
If D1> .7999 then D1 color is red.
If A2 = "Good" then D1 color is blue.

So what color do you want D1 to be when all three conditions are met?

Best regards,
Trowa
0
ross_jeremy Posts 2 Registration date Friday September 23, 2011 Status Member Last seen September 26, 2011
Sep 26, 2011 at 11:25 AM
#1. If A1 = "Bad" B1 to G1 Cell color is Grey which D1 would be grey
#2. If A1 = "Good" B1 to G1 Cell color is Green which D1 would be grey
#3. If A2 = "Good" B3 to G3 Cell color is blue
#4. If D1 > greater than .7999 cell color is red
#5. If D1 < less than 4.5555 cell color is red

If #4 and or #5 are not true D1 will follow #1 and #2

Hope this makes things a bit clearer

Thank you for your help.
0
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 552
Sep 27, 2011 at 09:13 AM
Hi Ross,

Thanks for clearifying your issue.

Try this:
Select B1 to C1 and E1 to G1. Conditional format formula:
1. =$A$1="Bad" color grey.
2. =$A$1="Good" color green.

Select B3 to G3. conditional format formula:
1. =$A$2="Good" color blue.

Select D1. Conditional format formula:
1. =AND(D1>0.7999,D1<4.5555) color red.
2. =OR(A1="Bad",A1="Good") color grey.

Best regards,
Trowa
0