Sub topic 12
Rule Order, Conflicts and Stop If True
This chapter assumes you can create formula-based rules, understand relative and absolute references, and have opened the Conditional Formatting Rules Manager (Home > Conditional Formatting > Manage Rules). Here you learn what happens when several rules apply to the same cell.
How Excel Evaluates Multiple Rules
A cell can be covered by many rules at once. Excel checks every rule that applies to the cell, from the top of the list in the Rules Manager to the bottom. Rules higher in the list have higher precedence.
What happens next depends on whether the rules conflict:
- No conflict: The rules set different properties, so Excel applies all of them. A rule that sets a red fill and another that sets bold font both take effect.
- Conflict: The rules set the same property, such as two different fill colors. The rule higher in the list wins for that property.
Data bars, color scales and icon sets follow the same order. They can also combine with fill and font rules, because they draw different things in the cell.
A Worked Example
Suppose a task list in A2:E50 has two rules applied to the same range.
=$E2="Done"sets a gray fill and gray font.=$D2<TODAY()sets a red fill and white bold font.
A finished task with a past due date makes both rules true. The red fill is higher or lower depending on the order, so the order decides the result. If the "Done" rule is first, the row is gray. Because the two rules set different font properties, the lower rule can still add bold. The row can end up gray with bold gray text, which looks inconsistent.
To make finished tasks never look overdue, put the "Done" rule first and turn on Stop If True.
Using Stop If True
Stop If True tells Excel to stop checking lower rules for a cell once this rule is true. A lower rule then has no effect on that cell, even for properties the higher rule did not set.
To set it up:
- Select a cell in the range and open Manage Rules.
- Set Show formatting rules for to This Worksheet or to the current selection.
- Select the rule and use the up and down arrows to place it first.
- Tick Stop If True next to the rule and click OK.
With the "Done" rule first and Stop If True ticked, a finished task is gray and the overdue rule is never applied to it.
Reordering and Common Pitfalls
Place the most specific or most important rules at the top. General rules, such as banding, go at the bottom.
| Problem | Cause | Fix |
|---|---|---|
| A rule seems to do nothing | A higher rule sets the same property | Move the rule up, or change the higher rule |
| Overdue color shows on finished rows | Rule order is wrong | Put the "Done" rule first with Stop If True |
| Stop If True is unavailable or has no effect | The rule is a data bar, color scale or icon set in some versions | Use a formula rule for the logic, and check the version |
| Rules appear for the wrong range | The Rules Manager is showing the current selection only | Choose **This Worksheet** |
Exercise
A range has rule 1 (top): red fill when the value is over 100. Rule 2: green fill when the value is over 50, and bold font. A cell holds 120. What does the cell look like, and what changes if Stop If True is ticked on rule 1?
Show answer
Both rules are true. Both set a fill, so the higher rule wins and the fill is red. Rule 2 sets bold, which rule 1 does not set, so the cell is red and bold. With Stop If True on rule 1, rule 2 is skipped, so the cell is red and not bold.