Sub topic 12
Rule order, conflicts and Stop If True
This chapter assumes you can already create a formula-based conditional formatting rule, you know what the Applies to range is, and you have opened the Conditional Formatting Rules Manager. Here you will learn what Excel does when two or more rules apply to the same cell, how rule order decides the outcome, and what Stop If True does.
Several rules can apply to one cell
A cell can have any number of conditional formatting rules. Excel evaluates every rule whose Applies to range includes the cell. For each rule that is true, Excel applies that rule's formatting. The result is the combination of all the true rules, subject to the conflict handling described below.
Suppose cell C5 has two rules:
- Rule A: if the value is greater than 1000, use a green fill.
- Rule B: if the value is greater than 500, use a bold font.
If C5 holds 1200, both rules are true. The two rules set different properties, so there is no conflict. C5 gets a green fill and a bold font.
What counts as a conflict
Two rules conflict when both are true and both set the same formatting property. Examples are two different fill colors, two different font colors, or two different border styles on the same edge.
When rules conflict, the rule that is higher in the list in the Rules Manager wins for that property. The lower rule is not discarded. It still applies to any property the higher rule leaves unset.
Consider these two rules, listed from the top of the list down:
- Rule 1: value greater than 1000. Format: red fill.
- Rule 2: value greater than 500. Format: yellow fill and italic font.
For a cell containing 1200, both rules are true. The fill property conflicts, so Rule 1 wins and the fill is red. Rule 1 does not set italic, so the italic from Rule 2 still applies. The final look is a red fill with italic text.
For a cell containing 700, only Rule 2 is true. The fill is yellow and the text is italic.
Rule order in the Rules Manager
Open the Rules Manager from Home > Conditional Formatting > Manage Rules. Use the "Show formatting rules for" list to choose This Worksheet, the Current Selection, or another sheet. The rules appear in a list. The rule at the top has the highest precedence.
Excel adds each new rule at the top of the list. A rule you create later therefore outranks the ones you made earlier, which is often not what you want. Use the Move Up and Move Down arrow buttons to change the order. Select a rule, then click the arrow.
The order is a single list for the whole sheet, not one list per range. Two rules that apply to completely different ranges still sit in the same list. Their relative position matters only where their ranges overlap.
A worked example: status colors
Take a task list in A2:E50, where column E holds a status. You want these results:
- Rows marked "Blocked" are red.
- Rows marked "Done" are gray.
- Overdue rows that are not done are orange.
Apply all three rules to $A$2:$E$50 with these formulas:
=$E2="Blocked"=$E2="Done"=AND($D2<TODAY(), $E2<>"Done")The third rule already excludes "Done" rows, but it does not exclude "Blocked" rows. A blocked task that is overdue makes both the first and third rules true. If both set a fill, the higher rule wins. Put the Blocked rule above the overdue rule so that blocked tasks stay red.
The correct order from the top is: Blocked, Done, Overdue.
Stop If True
Each rule in the Rules Manager has a Stop If True check box. When a rule is true for a cell and its Stop If True box is checked, Excel does not evaluate any rule below it for that cell. The lower rules are skipped entirely, including properties the higher rule did not set.
This differs from normal precedence. With normal precedence, lower rules still contribute any properties the higher rule leaves unset. With Stop If True, they contribute nothing.
Take the earlier red and yellow example again. Rule 1 sets only a red fill. Rule 2 sets a yellow fill and italic text. Without Stop If True, a cell containing 1200 is red and italic. If you check Stop If True on Rule 1, the same cell is red and not italic, because Rule 2 is never evaluated for it.
| Setting on Rule 1 | Cell value 1200 | Cell value 700 |
|---|---|---|
| Stop If True off | Red fill, italic | Yellow fill, italic |
| Stop If True on | Red fill only | Yellow fill, italic |
The cell with 700 is unaffected because Rule 1 is false for it, so Excel never stops there.
When to use it
Use Stop If True to make rules mutually exclusive. A common case is a set of threshold rules where you want only the first matching tier to show:
- Value at least 90: dark green fill, stop.
- Value at least 75: light green fill, stop.
- Value at least 50: yellow fill, stop.
- Anything else: no formatting.
A score of 95 satisfies all three of the first rules. Without Stop If True, the top rule still wins the fill, but any other property set by the lower rules, such as bold text, would leak through. With Stop If True on each tier, a cell shows exactly one tier's format.
You can also build mutually exclusive tiers without Stop If True by writing each condition so it excludes the others, for example =AND($C2>=75,$C2<90). This is easier to read in the rule list, because each rule stands alone and does not depend on order.
Stop If True and the built-in visual rules
Stop If True has an effect on data bars, color scales, and icon sets only in some situations. In current versions of Excel, you can check it on any rule type in the Rules Manager. Excel also uses it for backward compatibility with Excel 2003, which allowed only three conditions. The setting has no effect on rules that Excel does not reach because a higher rule stopped evaluation. Test the result on your own data if you combine visual rules with stop behavior, because the display of data bars and icons depends on the version.
Which formats can conflict
Conditional formatting can set number format, font style, font color, underline, strikethrough, borders and fill. It cannot change font name, font size, or cell alignment. That limits the possible conflicts to the properties it can set.
Data bars, color scales and icon sets interact with ordinary formatting rules in their own way:
- A color scale sets the cell fill. A formula rule above it that sets a fill overrides the color scale for the cells where it is true.
- A data bar draws inside the cell. It can sit alongside a font color or bold rule without conflict.
- An icon set draws an icon. It can sit alongside a fill rule without conflict.
Manual formatting versus rules
A conditional format overrides the cell's manual formatting while the rule is true. If you set a cell's fill to blue by hand and a rule sets it to red, the cell appears red. When the rule becomes false, the manual blue shows again. Removing the rule also restores the manual format, because the manual format was never changed.
Common ordering mistakes
- A broad rule above a specific one. A rule like value above 0 sits at the top and its fill wins over a more specific rule below it. Move the specific rule above the broad one.
- Rules that look ignored. A lower rule seems not to work because a higher rule sets the same property. Open the Rules Manager and check both the order and the Stop If True boxes.
- Overlapping ranges. The same cell is covered by an old rule you forgot about. Set "Show formatting rules for" to This Worksheet to see every rule, not just those on the current selection.
- Reordering after copying. Copying and pasting formatting can add new rules at the top of the list and change the outcome of existing ones. Review the list after you paste.
Diagram: how Excel evaluates the rules for one cell
Exercises
Exercise
A cell has two true rules. Rule 1, higher in the list, sets a green fill. Rule 2, lower in the list, sets a yellow fill and a bold font. Stop If True is off on both. What does the cell look like?
Show answer
A green fill and a bold font. The fill conflicts, so the higher rule wins. Rule 1 does not set bold, so the bold from Rule 2 still applies.
Exercise
Same setup as before, but Stop If True is checked on Rule 1. What does the cell look like, and why?
Show answer
A green fill with no bold font. Because Rule 1 is true and has Stop If True checked, Excel never evaluates Rule 2 for this cell, so none of its properties apply.
Exercise
You created a rule highlighting overdue tasks in orange, then later added a rule highlighting "Blocked" tasks in red. Blocked tasks that are overdue appear red, but you want them orange. What do you change?
Show answer
Open Home > Conditional Formatting > Manage Rules and move the overdue rule above the Blocked rule. New rules are added at the top, so the Blocked rule currently has the higher precedence. Alternatively, make the Blocked rule's formula exclude overdue rows.