Sub topic 8
How Rule Order Decides Which Format Wins
Assume that you can select ranges, create basic conditional formatting rules, and enter simple Google Sheets formulas. This chapter focuses on what happens when more than one rule applies to the same cell.
Why rule order matters
A conditional formatting rule changes a cell's appearance when a condition is true. A rule can change the background color, text color, or other formatting.
Several rules can cover the same range. For example, a task table might have these rules:
- Highlight completed tasks in green.
- Highlight overdue tasks in red.
- Shade every other row.
A task can satisfy more than one condition. A completed task might also have a due date in the past. When rules overlap, Google Sheets checks them in the order shown in the Conditional format rules panel. The first matching rule is applied.
The rule order does not change cell values or formulas. It only changes which formatting appears.
A worked example
Imagine this range:
| Task | Owner | Due date | Status |
|---|---|---|---|
| Send report | Ana | 2026-11-20 | Done |
| Review budget | Lee | 2026-11-25 | Open |
Suppose the range is A2:D100. You create these rules:
- A green fill for completed tasks.
- A red fill for overdue tasks.
The completed task is also overdue if today's date is after November 20. If the green rule is first, the row appears green. If the red rule is first, the row appears red.
The correct order depends on the meaning you want:
- Put the completed rule first when completion should always take priority.
- Put the overdue rule first when warning users about late work matters more.
For whole-row formatting, the formulas could be:
=$D2="Done"=AND($C2<TODAY(),$D2<>"Done")The second formula already excludes completed tasks. That design reduces overlap and makes the rule order less important.
Put specific rules above general rules
A useful ordering principle is to place the most specific rules above broad rules.
For example, suppose you want:
- A dark red fill for overdue high-priority tasks.
- A light red fill for all overdue tasks.
Place the high-priority rule first. Otherwise, the broad overdue rule can match first and prevent the more specific formatting from appearing.
You can edit the order as follows:
- Select the formatted range.
- Open Format and choose Conditional formatting.
- In the rules panel, locate the rules that overlap.
- Drag a rule higher or lower in the list.
- Check the sheet after each change.
Color scales and overlapping rules
A color scale maps values to colors, such as red for low numbers and green for high numbers. It is useful for scores, quantities, and percentages.
A color scale can overlap a single-color rule. For example, a score range might have a color scale while a separate rule highlights missing values in gray. Decide which visual message should have priority. Put the more important rule first, and make sure the ranges and conditions do not conflict unnecessarily.
Color scales also need a suitable numeric range. A text value, blank cell, or unexpected error can produce results that do not match your expectations. Inspect the underlying values before changing rule order.
Inspecting and testing precedence
When several rules exist, test a cell that should match exactly one rule, then test a cell that should match two rules.
Use this process:
- Write down the expected formatting for each test cell.
- Check the Apply to range for every rule.
- Check each condition or custom formula.
- Move the preferred rule above the competing rule.
- Test again with a value that clearly matches both conditions.
- Remove or revise rules that duplicate the same purpose.
Rules with different ranges might not actually overlap. A rule applied to A2:A20 cannot affect a cell in B21, even if its formula refers to another column.
Common ordering mistakes
- A general rule appears above a more specific rule.
- A row rule covers the same cells as a cell-level warning rule.
- A rule's Apply to range is larger than intended.
- A formula uses a relative reference that shifts the condition to another column.
- A color scale is left active after a single-color rule is added.
- A rule is copied to a new range but remains above the intended rule.
Rule order is only one part of the result. The range, formula references, and actual cell values must also be correct.
Exercise
A task row should be green when its status is Done. It should be red when its due date has passed and its status is not Done. Which rule should be placed first, and why?
Show answer
Place the green Done rule first if completed work should always appear green. The overdue formula should still exclude Done rows with AND, so the two rules do not conflict.