+ Reply to Thread
Results 1 to 2 of 2

Conditional formatting rule accumulation after deleting row(s)

  1. #1
    Registered User
    Join Date
    02-13-2014
    Location
    Tampa, FL
    MS-Off Ver
    Excel 2010
    Posts
    2

    Conditional formatting rule accumulation after deleting row(s)

    Hello,

    I have researched my issue quite a bit on various forums and blogs, but I am unable to find a solution which specifically addresses the problem I'm having.

    Here is a link to another thread in this same forum with a similar issue (I replied to the thread with a link to a solution to that problem).

    The problem I'm having:

    I have Conditional Formatting (CF) rules applied to a table on a worksheet. The CF rules in my table get split (the ranges the formula is applied to splits into new rules) each time I delete a row. The result is that, every time I delete a row in the table, a new split in the range occurs, generating yet more and more rules (again, see the thread I have linked to and click on the link I created there).

    Example:

    I have created CF rules to color-fill cells in certain columns based on the conditions of relative cells in the same row (i.e. $B3:$B79 should turn yellow based on the condition of adjacent cells in column $G3:$G:79). The formula used evaluate the adjacent cell(s) is:
    Please Login or Register  to view this content.
    .

    Now, if I were to delete, say, row 59 entirely, I now see the CF rule duplicated, but it contains a new range (=$B$4:$B$60), while the range for the original rule has also been modified (=$B$3,$B$61:$B$78). It seems that Excel is trying to adapt the CF rule to the table's new range, given the deleted row.

    This wouldn't be a problem, except; If I now go to add a new record to the last row of the table, Excel "knows" to include the new record in the table, but Excel does not expand the range of the CF Rule to include the new record (in other words, the CF is not applied to the new record).

    I've tried a couple of possible work-arounds, to no avail:

    -Clear contents (instead of delete row) and then re-sort the table to push the record to the end, then delete the empty row.
    Result: multiple CF rules

    -Clear contents (instead of delete row) and then re-sort the table to push the record to the end, then resize table.
    Result: Conditional formatting is applied to rows outside the table. Deleting the outside row results in multiple CF rules.

    The strange thing is, I have other CF rules which do not split ranges when records are deleted. The formula is slightly different:
    Please Login or Register  to view this content.
    Which is supposed to change color of text to Blue when the text "DrugCt" is present in a cell within the range.

    So, I tried re-coding the formula for my problem CF rule as follows, hoping it was the solution:
    Please Login or Register  to view this content.
    , then deleted a row.
    Result: multiple CF rules.

    I know this was a long post, but I wanted to give as much detailed information as possible. I am stuck having to reselect the ranges for the 2 problematic CF rules every time I delete a row. Very frustrating.

    I appreciate any help or insight!
    Last edited by dgiberga; 02-13-2014 at 12:03 PM. Reason: clarification

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,463

    Re: Conditional formatting rule accumulation after deleting row(s)

    Superb explanation of the problem ... maybe a little overwhelming if you've never encountered the problem. But I have

    I'm not 100% sure why it happens, but I know it surely does. And it can be hugely problematic. In my scenario, I was replicating and deleting large blocks of data which could be a number of columns or a number of rows, each block having several CF conditions. In testing, it worked fine. In real life, the workbook ground to a halt and the Name Manager wasn't even capable of listing all the conditions.

    I eventually opted to use a macro called in the Workbook Open event to delete and re-create the CF formulas and formatting. Bit of a cludge but it is executed every time the workbook is opened so it never gets out of hand.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Multiple Rule Conditional Formatting
    By jbenkov in forum Excel General
    Replies: 8
    Last Post: 11-30-2012, 12:21 PM
  2. Copying Conditional Formatting Rule
    By chrisohara in forum Excel General
    Replies: 3
    Last Post: 01-07-2012, 01:06 AM
  3. Conditional formatting rule need help
    By Kagesen in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-25-2011, 04:42 AM
  4. Replies: 1
    Last Post: 07-29-2010, 11:26 AM
  5. Excel 2007 : Conditional Formatting Percent rule
    By Ichigo in forum Excel General
    Replies: 1
    Last Post: 04-25-2009, 12:50 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1