I need to color a cell in Excel 2007 based on a statement like, if B6=H and C6=g then color A6 Blue

I have no idea what the proper script would be but here is my guess that does not work: =IF(AND(B6=$H$, C6=$g$),"MAKE A6 Blue")

I am trying to do contitional formatting. Could someone please get me on track?

1 Answer 1


Yes, you're on the right track. You want a formula like:


You would add this as a Conditional format (Home tab in the Styles section) on A6. Select New Rule... and then "Use a formula to determine which cells to format". You use the above formula for the condition and then use the Format section to Fill the cell as you require.

You can modify the formula further to make it more generic or to make it work on other cells in the same row/column.

  • Your suggestion will make the cell True or False, which is good, but I need it to color the field not plug in True or False. Any suggestions on adding a color fill to the script?
    – LtDan
    Apr 19, 2011 at 12:55
  • Updated to make it clearer, I hope. You don't put the formula in the cell, you put it in the conditional format. Apr 19, 2011 at 20:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.