Sub topic 11
Troubleshooting Rules That Do Not Behave as Expected
This chapter assumes that you can navigate a spreadsheet, enter simple formulas, and select ranges such as A2:F100. Conditional formatting often fails because the rule evaluates a different cell than you intended, uses the wrong data type, or loses to another rule.
A reliable troubleshooting process
Start with the rule, not the visual result. Select the formatted range, open Format > Conditional formatting, and inspect these three parts:
- Apply to range: Which cells can receive the format?
- Format rules: What condition or custom formula is being evaluated?
- Formatting style: Is the selected text or fill color easy to see?
Test with one obvious value. For example, if a rule should highlight rows whose status is Done, type Done into one known status cell. If nothing changes, check the range and formula before changing colors.
Use this flow when a rule fails:
Match the formula to the apply range
A custom formula is evaluated relative to the top-left cell of the Apply to range. If the range is A2:F100, the formula is normally written as if it is checking row 2.
To highlight an entire row when the status in column C is Done, apply the rule to A2:F100 and use:
=$C2="Done"The dollar sign fixes the column at C. The row number remains relative, so row 2 checks C2, row 3 checks C3, and so on.
If you instead apply the rule to A1:F100 but keep the formula referencing row 2, every row is offset by one. The first data row checks the wrong status. Either change the range to A2:F100 or adjust the formula to match the range's top-left row.
A frequent error is anchoring the row as well:
=$C$2="Done"This checks C2 for every row. If C2 contains Done, the whole range may be highlighted. If C2 does not contain Done, no row is highlighted.
Check data types and hidden differences
A cell that looks like a number may actually be text. A date may also be text if it was imported or entered with an unrecognized format. Built-in rules such as Is greater than depend on the value being numeric.
Text can contain differences that are difficult to see:
- Done and done are different for some comparisons.
- A trailing space makes Done different from Done followed by a space.
- A value copied from another system may contain a non-breaking space.
- A date-looking value may not be a real date.
Temporarily use a helper cell to inspect a value. For example, ISNUMBER checks whether a value is numeric, and ISTEXT checks whether it is text. You can also compare a status cell directly with a formula in an unused column.
| Symptom | Likely cause | Check |
|---|---|---|
| Nothing highlights | The condition never becomes TRUE | Test one obvious value |
| The wrong rows highlight | The row reference is offset | Compare the apply range's first row with the formula |
| Every row highlights | The row is absolutely anchored | Remove the dollar sign before the row number |
| Dates behave strangely | Dates are stored as text | Check whether the cell contains a real date |
| A rule appears ignored | Another rule supplies the visible format | Inspect overlapping rules and their order |
Inspect references and formula behavior
When a formula refers to another column, anchor only the column that must stay fixed. For example, this rule highlights overdue, unfinished rows when applied to A2:E100:
=AND($D2<TODAY(),$E2<>"Done")Column D contains the due date, and column E contains the status. The row changes as Sheets evaluates each row. If you write D2 and E2 without dollar signs, the references can shift across columns as the rule applies to the rest of the range.
When a rule should detect duplicates in A2:A100, use:
=COUNTIF($A$2:$A$100,$A2)>1The counted range is fixed. The value being tested changes from A2 to A3 and onward. If the formula returns an error, check for a misspelled sheet name, invalid range, or a formula separator that does not match your spreadsheet locale.
Check overlapping rules and test simply
Several rules can apply to the same cell. A cell may meet more than one condition, so the final appearance can differ from the style you expected. In the conditional-formatting panel, review the rules from top to bottom. Temporarily turn off unrelated rules or move the rule you are testing higher.
Use a strong temporary style, such as a bright fill and bold text. Test a single cell before testing a large range. Once the condition works, restore the intended style.
When the rule uses another sheet
A custom formula cannot always refer directly to a range on another sheet. To test whether A2 appears in column A of a sheet named Lists, apply the rule to A2:A100 and use:
=COUNTIF(INDIRECT("Lists!A:A"),$A2)>0Confirm that the sheet name and range are spelled exactly. If the sheet name contains spaces, include the single quotes inside the text passed to INDIRECT, such as INDIRECT("'Task Lists'!A:A"). Also check that blank cells are not being treated as matches.
Final diagnostic checklist
Before rebuilding a rule, verify:
- The Apply to range starts on the row used by the formula.
- The formula returns TRUE for a test row.
- Dollar signs fix only the references that should not move.
- Numbers and dates are stored as the expected types.
- Text has no extra spaces or unexpected capitalization.
- The rule is not hidden by an overlapping rule.
- The formatting style is visible.
- Cross-sheet references use a valid sheet name and range.
Exercise
A rule applied to A2:F100 uses =$C$2="Done", and every row highlights when C2 says Done. What should you change to evaluate each row's status?
Show answer
Use =$C2="Done". The column stays fixed at C, while the row changes for each row in the apply range.