This tutorial will demonstrate how to highlight cells depending on the answer returned by an IF statement formula using Conditional Formatting in Excel and Google Sheets.
Highlight Cells With Conditional Formatting
- First, create the IF statement in Column E.
- This formula can be copied down to Row 12.
- Now, create a custom formula within the Conditional Formatting rule to set the background color of all the “Overdue” cells to red.
- Select the range you want to apply formatting to.
- In the Ribbon, select Home > Conditional Formatting > New Rule.
- Select Use a formula to determine which cells to format, and enter the formula:
- Click on the Format button and select your desired formatting.
- Click OK, and then OK once again to return to the Conditional Formatting Rules Manager.
- Click Apply to apply the formatting to your selected range and then click Close.
The formula entered will return TRUE when the cell contains the word “Overdue” and will therefore format the text in those cells with a background color of red.
- To format the “OnTime” cells to green, you can create another rule based on the same range of cells.
- Click Apply to apply to the range.
Highlight Cells If… in Google Sheets
The process to highlight cells that contain an IF Statement in Google Sheets is similar to the process in Excel.
- Highlight the cells you wish to format, and then click on Format > Conditional Formatting.
- The Apply to Range section will already be filled in.
- From the Format Rules section, select Custom Formula and type in the formula.
- Select the fill style for the cells that meet the criteria.
- Click Done to apply the rule.