Conditional formatting is a great way to highlight specific data, but did you know that it can automatically create new rules on its own? I’ll show you how that happens, and an easy way to fix those conditional formatting duplicated rules.
Video: Conditional Formatting Duplicated Rules
Watch this video to see how the duplicated rules are created, and an easy way to fix the problem. There are written instructions below the video.
Simple Conditional Formatting Rules
In this example, there is a small table, with 2 simple conditional formatting rules:
- In column E, highlight prices that are greater than 500
- In columns A:E, add a blue top border if the date in column A is different from the date above
New Rule Automatically Created
To see how a new rule is automatically created, delete row 10 in this table. Then, go to Conditional Formatting > Manage Rules, to see the results.
- The original rule has changed, and excludes the deleted row.
- There is a new rule that applies to row 10 only, and it has a #REF! error
Why It Happened
The new rule was created because the Top Border rule has a formula that refers to another row. It compares the date in the current row, to the date in the row above:
When you delete a row, the row below that loses its reference to that row. If we had the same formula on the worksheet, you’d see a #REF! error.
The same #REF! error occurs in the conditional formatting formula, so Excel creates a new rule for that formula.
Fix Conditional Formatting Duplicate Rules
If you frequently delete and insert rows, you could end up with many duplicated rules. In a big workbook, that could potentially slow down your workbook’s calculation speed.
And, you might not even know about those extra rules, unless you go into the Manage Rules dialog box for some reason.
I’ve written about this problem before, and there are a few ways to prevent the problem from occurring. Now that I’ve found an easy way to fix the problem, I don’t worry about prevention – I just clean things up when necessary.
Easy Steps to Fix the Problem
Here are the easy steps to remove the conditional formatting duplicate rules:
- Except for the first row, select all the rows with the same conditional formatting rules
- On the Excel Ribbon’s Home tab, click Conditional Formatting
- Click Clear Rules, then click Clear Rules from Selected Cells
- Select the first row, and on the Excel Ribbon’s Home tab, click the Format Painter
- Drag the Format Painter over all the cells where the conditional formatting rules should be applied, including the first row
To confirm that the duplicate rules were removed, go back to the Manage Rules window. Only the two original rules should be listed.
Get the Sample File and Macro
To get the sample file that I used in this example, go to the Conditional Formatting page on my Contextures website. The details are there, as well as the macro code. Scroll down a bit to see the link to download the file – it is in xlsx format, so the macro isn’t in that file.