Excel - Conditional Formatting - insert row

前端 未结 16 1491
轮回少年
轮回少年 2021-01-01 11:37

Using Offset or Indirect in \'Applies To\' does not seem to work. Is there any other way to stop conditional formatting from breaking after inserting row/s

相关标签:
16条回答
  • 2021-01-01 12:08

    I realize this is an old post, but I was running into the same problem and have since figured out how to not get the split conditional format rules.

    In my Excel 2010 spreadsheet, I enter dates into column B. Some times I fat finger the date entry, which is why I wanted to conditionally format them. Initially, I was selecting a range (B2:B1960), so my formula in the Conditional Formatting Rule would be "=B2:B1960>TODAY()".

    Well, that worked fine until I went to insert new rows between existing rows. The rules would split just as the OP described. I happened to look at several different websites and found a Microsoft Office site that pointed me to the answer. It mentioned to highlight the range that you want to format, but change the formula to "=B2>TODAY()".

    Since changing the formula, I can now insert new rows between existing rows and not get the split Rules as before. Here is the link to that web page. http://office.microsoft.com/en-us/excel-help/use-a-formula-to-apply-conditional-formatting-HA102809768.aspx

    0 讨论(0)
  • 2021-01-01 12:09

    What you have to do is 1) insert a new row 2) copy the row you want to clone 3) paste special "Merge Conditional Formatting"

    Not intuitive and a mountain of user training if you want others to share the workbooks you create

    0 讨论(0)
  • 2021-01-01 12:14

    What works for me is, when you insert a row, don't copy the formatting from another row. Only copy-special paste the formulas. The conditional formatting then does not get split up.

    0 讨论(0)
  • 2021-01-01 12:15

    In 2013, Once you find your formatting rules have been split/duplicated, define a new namedrange for each format. Then set the applies to =[Named Range]. Excel will replace the named range with the actual range. Then delete the duplicate formats.

    0 讨论(0)
  • 2021-01-01 12:17

    I'm building a solution that others with mixed Excel skill levels will come into play, so I needed something easier and more consistent than to have them remember to copy and paste a certain way.

    In Excel 2016, you can insert a table from a selected range which then gives you the benefit of using structured references (example: tblTOP[Type], to reference data in the Type column of the table named tblTOP).

    I then found this answer at Microsoft's site that shows an effective way to reference a table in the formula part of CF: conditional formatting structured references


    So, with that established...

    This is what I'm working with:

    tblTop Columns

    I set up my conditional formatting so that when I change the Type value anywhere between A to E, it will change that row to a corresponding color. (Example shown: B turns the row to green)

    This was accomplished by using the formula =INDIRECT("tblTOP[Type]")="B"

    When I went to add a row though, I got the same formatting applied to that second row :(.

    Broke CF between two rows

    CF formula that worked

    Long story short, the following formula is what I came up with to apply my CF rule to that particular row and not affect any rows being added or taken away:

    =INDIRECT("tblTOP[@Type]")="B"

    The addition of the '@' in front of the structured reference keeps things happening just for that given row. Nice.

    So now I can tab through or use the context menu to add a new row and it awaits the type selection to determine the color for that row only.

    New Row added clean

    New Row working as expected

    I haven't tested it with pasting cells as the purpose of this table is for the end user to enter data and add/delete rows as needed, so I can't say if this will work with pasting a row.

    Hope this helps someone with conditional formatting in a table.

    0 讨论(0)
  • 2021-01-01 12:20

    My solution to this exact problem was clearing the formatting from the source copy. Steps:

    1. Copy source onto clipboard
    2. Open new excel document
    3. Paste Special, select formula (copies values and formulae and omits formatting)
    4. Copy this to clipboard
    5. Now you can either paste back to the source before using it or you insert blank rows into the sheet with the conditional formatting (note just inserting rows will not change the range on the conditional formatting rules) and paste the clipboard content into the new rows.

    This worked for me using MS Excel 2016

    0 讨论(0)
提交回复
热议问题