Excel 2010 Conditional Formatting Nightmare

Excel 2010 Conditional Formatting Nightmare

[Updated June 2018] I’m a big fan of Excel’s conditional formatting, and often use it to highlight cells on a worksheet. But this week I ran into a conditional formatting nightmare, 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

There are lots of ways to use Excel conditional formatting. It’s useful for alerting people to problems, hiding duplicate values in a column, or even hiding cells’ contents, until related cells are filled correctly.

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.

ConditionalFormatSections04

Easier to Read

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.

ConditionalFormatDuplicate01

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.

ConditionalFormatDuplicate02

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.

ConditionalFormatDuplicate04

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.

ConditionalFormatDuplicate05

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.

There is a full transcript of the tutorial following the video.

TRANSCRIPT FOR THE VIDEO

Conditional Formatting

In this workbook, I’ve got a couple conditional formatting rules, and I’m going to show you how those can get duplicated, so you end up with lots more rules than you started out with, and then how you can fix the problem.

So in this table I have two rules. 

–One puts a line at the top of a date, if it’s different from the date above.

–The other rule changes the price to green, if it’s greater than $500 dollars.

We’ll take a look at those rules. In the Home tab, go to Conditional Formatting, Manage Rules.

And there you can see the two rules. They’re each applied from row 3 to 19 in this table.

–Now this one is just a cell value greater than 500. 

–And this one is referring to a couple of cells. So if A2 is different from A3, we’re going to put a blue line, at the top of the cell.

How Problems Happen

And now, I’m going to insert a row, because I forgot to put in one of the records here. So I’ll click, Insert. And then just put some data in this row.

So that was a simple change to the table. And now I’m going to go back and look at my conditional formatting rules again. And suddenly I have a new rule, just for the row that I inserted. 

So row 11 has its own rule, and the previous rule is still there, going from A3 to E10, and then A12 to E20. So it’s skipping this row, because that row has a separate rule.

And if you insert lots of rows, you can end up with hundreds of these rules set up, without even knowing it.

The Solution

And what I do to fix it is select all the rows, except for the first one. Then go to Conditional Formatting, Clear Rules, From Selected Cells.

Now if I go back in, and Manage Rules…I’ll go back to This Worksheet, just so we can see everything. So we’re back to those two original rules.

Then, I select the first row. I’ll select the first row in the table, this time, instead of the whole worksheet.

And go to the Format Painter, and make sure you’re selecting this first row as well, and apply that formatting to all the rows again.

And when we go back to Manage Rules, we still just have those two original rules.

If you need to do this frequently, go to my website to get a macro that removes the duplicate rules. It’s designed for data in in an Excel named table.

End Of Transcript

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.

ConditionalFormatDuplicate06

With all the extra rules gone, the conditional formatting borders were working correctly again.

Avoid Conditional Formatting Nightmare

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.

ConditionalFormatDuplicate07

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!

Another Solution

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.
________________

83 thoughts on “Excel 2010 Conditional Formatting Nightmare”

  1. That is the problem not only with Excel 2010 but with earlier versions too.
    Btw don’t you think that context menu is a bit more convenient than Paste Values button?

      1. My tip for pasting values is “Ctrl-Alt-V” and then press “V” again for “Values” and Enter. On a mac it’s “Ctrl-Cmd-V”.

    1. @Jan Karel, thanks, this was happening in Excel 2010, although the file was built in an earlier version, probably 2003. I get the same results in a new Excel 2010 too.

      1. I have Excel 2013. Had some fairly complex conditional formatting appied via VBA. Was all working since I created the spreadsheet and today has just stopped and gone crazy. It keep making the formula in the conditional format reference the first row where the formula was entered and if I remove the dollar signs it just puts them back in. More confusing still whilst the formatting appears wrong whenever you look at the formulas behind it, sometimes it still actually works!

  2. I’ve faced this problem ever since Excel 2007, when Microsoft introduced the new conditional formatting features (more than 3 conditions; icons / graphics; and other stuff).
    Luckily I discovered a different solution before it could get as bad as your worksheet 🙂
    Basically, you should keep at least 3 blank records at the bottom of the table (which need not be a “table” table).
    Whenever I need to add more data in the table, I insert the required number of blank rows above the second-last row (with one blank row left *above* the new rows being added). Then I simply use Ctrl+D (fill down) from the last blank record upto the second last record in the table.
    e.g. Data is in the range A1:E50
    I keep rows 48, 49 and 50 as blank records (which may include formulas, but no data)
    When I need to add say, 5 more blank records, I goto row 49, and insert 5 rows above it.
    Then I staying in row 49, I fill down upto row 54 (which is the new second-last row in the table).
    For some reason, if you do the above steps with only the last row blank (i.e. starting from row 50), it creates the same problem that you described in your post — multiple conditions keep getting added to the worksheet.

    1. @Khushnood, thanks, that’s an interesting solution, and it inspired me to try another test. I dragged down the marker at the bottom right of the table, to make it 3 rows longer. Then, I was able to do a normal copy and paste to the new rows, without adding a new conditional formatting rule.

      1. Looks like the bug that is still there is that pasting below the table causes expanding of the table, which then adds the CF of the table on top of the CF of the pasted cells.
        Might be useful to file a bug for this Debra.

    2. As far back as I can remember, Excel duplicates the formatting of the row above the one being inserted. In your example, inserting a row in 48 will copy the formatting from 47. When inserting in 49, it copies from 48, which in your case is non-formatted. You don’t really need the third non-formatted row, 50.
      If I may clarify something, the filling down is only necessary if you have formulas on row 48, but not if it is blank.

  3. Thanks! I just found that same horror to one table that is “updated” regurlarly for the last few weeks.
    I deleted all conditional format, and started afresh to find that the problem repeated itself a few days later.
    I Will use the three lines empty at the bottom as a safeguard as it is easier to enforce with other users then going to the paste values without organising for each one a paste value button on their ribbon. 🙂
    Thanks!

    1. @Danièle, thanks, and I’ll try to remember to use empty rows at the bottom of the table too. It’s a pain that extra steps are required though, for something that should be simple.

  4. I didn’t know you sold staplers too! The price is a little high, but I’m sure the quality is up to the same stellar standards as the rest of your site(s), so expect my order soon.
    FYI, in contrast to Jan Karel’s comment, it happens for me in cells that aren’t part of a table.
    The first time this happens, it’s scary. I’ve always just gone into the CF dialog, deleted the dupes, and reset the range on the original. This way is way better.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.