Updated March 2017. I’m a big fan of Excel’s conditional formatting, and often use it to highlight cells on a worksheet. It’s also useful for alerting people to problems, and other devious plots, like hiding cells’ contents, until other cells are filled correctly.
But this week I ran into a conditional formatting crisis, and had to start from scratch. Fortunately, the fix didn’t take too long, but with complex formatting, things could have been much worse.
Separate the Dates in a List
Earlier this year, I posted a tip for separating dates in a list, by using a red border at the start of a date change.
It’s a technique that I use in one of my own workbooks, which I update every morning. The red border really makes the list easier to read, especially if I’m looking at it before my morning coffee!
The conditional formatting was set for cells A2:F9, and uses a simple formula to see if the date is equal to the date in the row above.
Quick Copy and Paste
In the workbook, I track some daily statistics for my website, and use the same headings every day. So, to save typing time, I copy and paste the headings from the day before.
For example, in the screen shot above, I could copy the regions and products headings from B2:C4, and paste them into cell B10:C12, for the latest day’s data.
The Excel table automatically expands to include the new rows, and fills in the formulas in column F. Awesome!
And that copy and paste trick is what I’ve been doing every day, for months on end.
Trouble With the Lines
Suddenly, this week, I started having trouble with the red border between dates – it wasn’t going across the full table.
So, I went into the Conditional Formatting Manager, to fix the problem. But, instead of one simple rule, there were hundreds of rules! You can see the tiny scroll box at the bottom right in the screen shot below. That should give you some idea of how long that list was.
Every time that I copied and pasted within the conditional formatting range, it created another rule for the worksheet. Yikes!
Let’s take a look at the smaller example, where I just copied and pasted the Region and Product headings. Now, it has two rules, instead of one, after one copy and paste within the table.
Cleaning Up the Mess – UPDATED
UPDATE – March 2017: I’ve found a quicker way to fix the problem, as you can see in this video. Get the detailed steps on my Conditional Formatting page.
The previous solution is listed below, in case you’d rather try that.
Cleaning Up the Mess – ORIGINAL SOLUTION
I scrolled through the list, and deleted a few of the rules, but quickly realized that it would take far too long to delete all of them. So, to clean up the mess, I cleared the conditional formatting from the worksheet, and set it up again.
With all the extra rules gone, the conditional formatting borders were working correctly again.
Avoid the Conditional Formatting Problem
Now, when I want to save some typing time in the daily list, I copy the previous headings, and use the Paste Values button to create the new records. I’ve got a copy of that button on Excel’s Quick Access Toolbar, so it’s easy to click.
That adds the text, and the table expands, including the formulas – but the conditional formatting doesn’t create a new rule.
Be careful out there — don’t let this conditional formatting nightmare happen to you!
Update: Thanks to Khushnood, who suggested leaving 3 blank rows at the bottom of the table, and inserting new rows above that, when adding new data. Copy and pasting within the table doesn’t seem to produce the duplicate conditional formatting.
It’s still an extra step though, instead of a simple copy and paste.