Sub topic 13
Copying and clearing rules
This chapter assumes you can write formula-based rules, know how relative, absolute and mixed references behave, and have opened the Conditional Formatting Rules Manager. Here you will learn how to reuse a rule on other cells and how to remove rules cleanly.
How rules travel with cells
A conditional formatting rule is stored with the range it applies to. When you copy cells, Excel copies the rule along with the values, fills and fonts. The pasted rule is a new rule with its own Applies to range. Excel does not keep it linked to the original.
This has one side effect. Copying and pasting cells can split one rule into several rules that each cover a small range. A sheet that has been edited this way can end up with dozens of near-identical rules. The Rules Manager shows them as separate rows.
Copying rules with Format Painter
Format Painter copies the rule and the regular formatting together. This is the quickest way to reuse a rule on another range.
- Select a cell that carries the rule.
- Choose Home, then Format Painter. Double-click the button to paint more than once.
- Drag across the destination cells.
Relative references in a formula rule shift according to the position of the destination. Suppose a rule =$C2>1000 was written with the active cell at A2. If you paint it onto a range that starts at A10, the rule is adjusted to use $C10 for that range. This is why you should check the active cell when you write a rule: Excel interprets relative references from that cell.
Copying only the rule with Paste Special
If you want the rule without the cell values, copy the source cells and choose Home, Paste, Paste Special, then Formats. This pastes all formatting, including conditional formatting, and leaves the destination values untouched.
Extending a rule instead of copying it
Often you do not need a second rule. You need the existing one to cover more cells. Open Home, Conditional Formatting, Manage Rules, find the rule, and edit its Applies to box. For example, change $A$2:$E$50 to $A$2:$E$200. This keeps one rule to maintain, and it avoids the fragmentation described above.
Clearing rules
There are three levels of clearing, all under Home, Conditional Formatting, Clear Rules.
| Command | Effect |
|---|---|
| Clear Rules from Selected Cells | Removes rules that touch the selected cells only |
| Clear Rules from Entire Sheet | Removes every rule on the active sheet |
| Clear Rules from This Table | Removes rules from the selected Excel table (shown when a table is selected) |
Clearing a rule removes the highlighting but keeps the cell values and any manual formatting. To remove a single rule and keep the others, open the Rules Manager, set Show formatting rules for to the right scope, select the rule and click Delete Rule.
A common mistake is to clear rules from a selection that covers only part of a rule's range. Excel then trims the rule's Applies to range instead of deleting it. Check the Rules Manager afterward if you want to confirm what is left.
Cleaning up duplicated rules
After heavy copying, use this routine:
- Open the Rules Manager and set Show formatting rules for to This Worksheet.
- Look for rows with the same formula and format but different ranges.
- Delete the extras and edit one remaining rule so its Applies to covers all the ranges, separated by commas, such as
$A$2:$E$50,$A$60:$E$90.
Exercise
A rule =$C2>1000 applies to $A$2:$E$50. You use Paste Special Formats to copy cells from rows 2 to 50 onto another block in the same sheet, and the Rules Manager now shows two rules instead of one. What is the simplest way to return to a single rule, and what should you check first?
Show answer
Check that both rules have the same formula and the same format. Then delete one rule and edit the other so its Applies to range covers both blocks, separated by a comma. Also confirm that the formula's references still point to the intended column after the paste.