In Excel, how would I perform the following using the IF condition?

  • If cell is empty then set the background color to red.
  • If cell has a value then set the background color to green.
  • 4
    To change the background color of a cell, you would use conditional formatting, rather than trying to use the IF() function in a cell formula. – MrWhite Oct 15 '12 at 14:13

You could apply a regular red fill, then use conditional formatting to make it green if populated, e.g. in conditional formatting use the

"use a formula to determine which cells to format" option with the formula


assumes formatting applied to cell A1, change as appropriate. For a range of cells just write the formula for the top left cell, e.g. to format B3:J10 this way select that range and use


  • 1
    Alternately, set both rules in Conditional Formatting. For a rule to apply if empty, use something like =A1="". Another nice thing about Conditional Formatting, is that it can be set for one rule to apply to multiple (and non-adjacent) cells. – Iszi Oct 15 '12 at 16: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.