How can I use an IF statement to turn the cell color red in Excel?


Often you may want to use an IF statement to turn a cell color red in Excel if it meets a certain condition.

The following example shows how to do so in practice.

Example: Use IF Statement to Turn Cell Color Red in Excel

Suppose we have the following dataset in Excel that shows the number of points scored by various basketball players:

Now suppose that we would like to turn each cell in the Points column red if it has a value less than 20.

To do so, highlight the cells in the range B2:B13, then click the Conditional Formatting dropdown menu on the Home tab and then click New Rule:

In the new window that appears, click Use a formula to determine which cells to format, then type =B2<20 in the box, then click the Format button and choose a red fill color to use.

Once we press OK, all of the cells in the range B2:B13 that have a value less than 20 will now be red:

Excel use IF statement to turn cells red

Note that in this example we turned each cell color red that had a value less than 20, but you can use whatever formula you’d like as the rule for determining which cells should be red.

Excel: Apply Conditional Formatting if Cell Contains Text

x