Sub topic 9
Editing, Copying, and Deleting Rules
This chapter covers how to maintain conditional formatting after you have created it. It assumes you can open the conditional formatting sidebar, write a custom formula rule, and read the dollar-sign anchors in a formula such as =$C2="Done". It also assumes you know how rule order decides which format wins. You will learn to find and change rules, copy them to other places, remove them cleanly, and avoid the errors that come with each of these operations.
Where rules live
Conditional formatting rules are stored on the sheet (tab) where you created them, not in individual cells. Each rule holds three things: the range it applies to, the condition, and the formatting style. When you open Format > Conditional formatting, the sidebar shows the rules that belong to the current sheet, in order from top to bottom.
The sidebar has two behaviors that matter for maintenance:
- If you select a cell or range that already has rules, the sidebar lists only the rules that touch that selection. Rules that apply elsewhere on the sheet are hidden.
- If the selection has no rules, the sidebar opens a new, empty rule.
This filtering is the most common reason people think a rule has vanished. The rule is usually still there, but it does not overlap your current selection. Click a single cell in a corner of the sheet, such as A1, and reopen the sidebar to see what is listed, or select the whole sheet with Ctrl+A (Cmd+A on Mac) to see every rule on the tab.
Editing a rule
To edit a rule, select any cell it covers, open the sidebar, and click the rule's card. The card expands into the same form you used to create it. You can change three parts independently.
Changing the range
The "Apply to range" box at the top of the rule accepts one or more ranges separated by commas, for example A2:F100, H2:H100. Edit the text directly, or click the grid icon beside it and drag a new selection on the sheet. Changing the range does not alter the condition or the style.
When you widen or move a range, remember what the formula in a custom rule is relative to. Google Sheets evaluates a custom formula as if it were typed into the top-left cell of the first range. If you change the first range from A2:F100 to A5:F100, the formula =$C2="Done" now evaluates as if it were written in A5, so it refers to C2 for that cell only by coincidence of the old layout. In practice the formula is not rewritten for you. You must update it to =$C5="Done".
Here is the rule in practice:
| Apply to range | Formula that is correct |
|---|---|
| `A2:F100` | `=$C2="Done"` |
| `A5:F100` | `=$C5="Done"` |
| `B2:G100` | `=$C2="Done"` |
The third row shows that shifting columns does not matter here, because the $ fixes the column to C. Only the row of the top-left cell matters.
Changing the condition
Pick a different condition from the dropdown, such as changing "Text contains" to "Custom formula is". Be aware that switching condition types can clear the value you entered. Copy a complicated formula to the clipboard before you change the type, so you can paste it back.
Changing the format
Use the paint-bucket and text-color buttons, or the bold, italic, underline, and strikethrough buttons, to change the style. The Reset link in the style row returns the style to the default. A rule with no visible style change does nothing, so if you click Reset, set a new style before you click Done.
Click Done to save. Edits apply immediately and are recorded in the version history like any other change, so you can undo with Ctrl+Z while the sidebar is open or restore an earlier version later.
Reordering as part of editing
Rules sit in a list, and the order matters. The first rule in the list that is true for a cell wins when two rules set the same property, such as fill color. You can drag a card up or down using the grip handle on its left edge. After you edit a rule's range, check that it still sits in the correct position, because a rule that now covers more cells may start overriding a rule beneath it.
Copying rules
There are three practical ways to copy rules. They differ in what they copy and where the copy goes.
Duplicate within the sidebar
Hover over a rule card, click the three-dot menu, and choose Duplicate. The copy appears directly below the original with the same range, condition, and style. This is the fastest way to make a second rule that differs by one value, for example a "Blocked" rule next to a "Done" rule. After duplicating, edit the copy's formula and color, and check its position in the list.
Paste special: conditional formatting only
To copy the rules from one range to another on the same sheet:
- Select the source cells and press Ctrl+C (Cmd+C).
- Select the destination range.
- Choose Edit > Paste special > Conditional formatting only.
This copies the rules and adjusts them to the new location. Custom formulas are shifted according to the usual relative-reference logic, the same as when you copy a formula. A formula =$C2="Done" pasted into a range starting at row 20 becomes =$C20="Done". A fully absolute reference such as $C$2 stays put, which is a frequent source of mistakes.
A normal paste (Ctrl+V) also brings the conditional formatting along, along with values and formulas. Use "Conditional formatting only" when you want to leave the destination's contents alone.
Copying a whole sheet
When you duplicate a sheet using the tab menu, Duplicate, its conditional formatting rules come with it. Rules that point to the original sheet by name, for example through INDIRECT("Lists!A:A"), keep pointing to the sheet named Lists. They do not follow the copy. Check cross-sheet rules in a duplicated sheet to be sure they refer to the data you intend.
You can also use Copy to > Existing spreadsheet on a sheet tab. The rules are copied with the sheet. If the destination spreadsheet does not contain a sheet named in an INDIRECT call, the rule finds no match and formats nothing, without raising an error.
What the copy does to overlapping rules
When you paste conditional formatting onto cells that already have rules, the new rules are added to the existing ones. They are not merged and they do not replace the old rules. After a few paste operations you can end up with several near-identical rules on the same cells. Open the sidebar and look for stacked duplicates.
Deleting rules
There are two ways to remove formatting, and they do different things.
Remove a single rule
Open the sidebar, hover over the rule card, and click the trash can icon. The rule is removed from every range it covered. This is the cleanest option when you know which rule is wrong.
Clear formatting from cells
Selecting cells and choosing Format > Clear formatting (Ctrl+\\) removes the direct formatting of the cells, such as fonts and fills you applied by hand. It also removes conditional formatting rules from the selected cells. Be careful with this option, because it affects only the selected range and it removes manual formatting you may want to keep.
Here is how partial deletion behaves when a rule covers a larger range than your selection. If a rule applies to A2:F100 and you clear formatting on A2:F10, Sheets does not delete the rule. It trims the rule's range to the remaining cells, which becomes A11:F100, and may split a range into several pieces if you cleared the middle. Afterwards the "Apply to range" box can list multiple ranges. If you later edit a formula in that situation, remember that the formula is evaluated relative to the top-left cell of the first range in the list, which may no longer be the cell you expect.
Deleting rows and columns
Deleting a row or column that sits inside a rule's range shrinks the range automatically. If you delete row 50 from A2:F100, the rule now covers A2:F99. If you delete every row or column the rule covers, the rule is removed. Inserting rows inside the range extends it. Inserting a row just below the last row of the range does not, so new data added at the bottom may be unformatted. To avoid this, apply rules to a range that ends past the real data, or to whole columns such as C:C when the rule does not need a header exclusion.
A worked maintenance example
Suppose a task tracker has rules on the sheet Tasks:
A2:F100with=$C2="Done"and a green fill.A2:F100with=AND($D2<TODAY(),$E2<>"Done")and a red fill.A2:A100with=COUNTIF($A$2:$A$100,$A2)>1and a yellow fill.
You now add a title row above the data, so the header moves from row 1 to row 3 and the data starts at row 4. Sheets shifts the ranges as rows are inserted, so the ranges become A4:F102 and A4:A102. The formulas are updated too, because they are references to cells that moved. This works when you insert rows, because Sheets treats the references in the rule as ordinary references.
Not every change is handled so well. If you cut and paste cells, the formula references might not follow. To confirm the result, do this:
- Select the whole sheet and open the sidebar.
- Click each rule in turn.
- Compare the first cell of the range to the row number used in the formula.
- If they disagree, retype the formula so it matches the top-left cell.
For the example above, the first rule should read =$C4="Done" when applied to A4:F102. The fix is quick when you know that the top-left cell is the anchor.
Next, the team wants the same tracker on a second sheet named Archive. You can use Paste special > Conditional formatting only, or duplicate the sheet. Duplicating the sheet keeps all three rules and their order. Afterward, delete the rules you do not need in the archive using the trash icon, rather than clearing formatting on the whole range, so that the remaining rules stay intact.
Common errors when maintaining rules
| Symptom | Likely cause | Fix |
|---|---|---|
| A rule is missing from the sidebar | The sidebar lists only rules overlapping the current selection | Select the whole sheet and reopen |
| Pasted rules highlight the wrong rows | The formula used `$C$2` (fully absolute) or the range's top-left cell moved | Rewrite the formula relative to the new top-left cell |
| Several identical rules appear | Repeated paste special operations added copies | Delete the extras with the trash icon |
| A copied sheet formats nothing | An `INDIRECT` sheet name does not exist in the copy | Create or rename the referenced sheet |
| New rows at the bottom are not formatted | The range ends at the last data row | Extend the range to cover future rows |
| A rule stopped working after a partial clear | The range was split and the first range changed | Check the list of ranges and the top-left cell |
Practical habits
- Keep the number of rules small. Several rules that differ only by a value can often be combined into one formula using
OR. - Order rules deliberately, and review the order after every edit.
- Use ranges that extend a little past the data, such as row 1000, so new entries are formatted.
- Before you restructure a sheet, take note of the formula in each rule. Afterward, check each formula against the new top-left cell.
- Name sheets used in
INDIRECTformulas with simple names, and avoid renaming them later.
Exercise
A rule applies to A2:F100 with the formula =$C2="Done". You change the range to A6:F100 but leave the formula alone. What happens, and what should the formula be?
Show answer
Sheets evaluates the formula as if it were in the top-left cell of the range, now A6, so the row part of the reference no longer lines up with each row. Cell A6 is checked against C2 instead of C6, and every row is off by four. The formula should be =$C6="Done".
Exercise
You select the range A2:F10 inside a rule that applies to A2:F100 and use Format > Clear formatting. What happens to the rule, and how can you check the result?
Show answer
The rule is not deleted. Its range is trimmed so it no longer covers A2:F10, and it now applies to A11:F100. To check, select the whole sheet, open the Conditional formatting sidebar, and read the "Apply to range" box of the rule.
Exercise
A tab was duplicated, and a rule with =COUNTIF(INDIRECT("Lists!A:A"),$A2)>0 highlights nothing in the copy, although it worked in the original. Name two things to check.
Show answer
First, confirm that a sheet named Lists exists in the file that holds the copy, because INDIRECT looks up the name and fails silently if it is missing. Second, confirm that the Lists sheet in that file has the values you expect in column A, since the copy refers to that sheet and not to the original's data.