+ Reply to Thread
Results 1 to 11 of 11

Conditional formatting: adding rows adds additional conditions; how to avoid that?

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    05-20-2017
    Location
    Boston, US
    MS-Off Ver
    Mac 2011
    Posts
    139

    Conditional formatting: adding rows adds additional conditions; how to avoid that?

    Hello!

    I am attaching the file and two screen shots, otherwise it will be hard to explain.

    In the tab called TASKS I have a set of conditional formatting rules, which initially extend from row 12 till row 42 (different columns for different rules).

    I hoped that adding a new row would extend the conditional formatting row range to 12 - 43, because one more row is added. It turns out not to be true.

    For example, if I want to insert a row between tasks 1.9 and 1.10, I do the following (in each case the formatting result is the same):

    1) copy 1.10
    click Insert copied cells
    get 1.10 on row 22 now
    the number of tasks is now 12 with the last one 1.12 (initially the last one was 1.11)

    2) add a new row between 1.9 and 1.10
    copy entire 1.9 (or 1.10) row
    paste copied row into a newly created one

    In both cases the result is the same. New conditional formatting rules are added (for the row 22), and the range of application of all initial rules is also changed - it is "split" now into a few ranges (see screen shot).

    How can I add rows and only extend the existing condition rules, without splitting the initial range and without getting new conditional rules?

    Thank you very much!
    Attached Images Attached Images
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 365 version 2501
    Posts
    18,855

    Re: Conditional formatting: adding rows adds additional conditions; how to avoid that?

    The following seems to work in the 2010 version, so I am hoping it will work for the Mac 2011 version.
    1) Add a named range, I called it 'Priority', with the following formula as the 'Refers to:':
    Formula: copy to clipboard
    =INDIRECT("TASKS!$f$12:$f$"&COUNTA(TASKS!$B$12:$B$1001)+11)

    2) Set the 'Applies to:' of the conditional formatting rules to: =Priority
    Note: As soon as you hit the 'Apply' key the 'Applies to:' will change to: =$F$12:$F$43 so it will appear the process didn't work.
    3) Add a row inside the table and look at the conditional formatting rules again and they will now be applied to =$F$12:$F$44 and if you remove a row they will again read =$F$12:$F$43
    Let us know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  3. #3
    Forum Contributor
    Join Date
    05-20-2017
    Location
    Boston, US
    MS-Off Ver
    Mac 2011
    Posts
    139

    Re: Conditional formatting: adding rows adds additional conditions; how to avoid that?

    Quote Originally Posted by JeteMc View Post
    The following seems to work in the 2010 version, so I am hoping it will work for the Mac 2011 version.
    1) Add a named range, I called it 'Priority', with the following formula as the 'Refers to:':
    Formula: copy to clipboard
    =INDIRECT("TASKS!$f$12:$f$"&COUNTA(TASKS!$B$12:$B$1001)+11)

    2) Set the 'Applies to:' of the conditional formatting rules to: =Priority
    Note: As soon as you hit the 'Apply' key the 'Applies to:' will change to: =$F$12:$F$43 so it will appear the process didn't work.
    3) Add a row inside the table and look at the conditional formatting rules again and they will now be applied to =$F$12:$F$44 and if you remove a row they will again read =$F$12:$F$43
    Let us know if you have any questions.
    Thank you for your reply. I followed your instructions, but it didn't work out.

    1) I still have to understand the formula your suggested - it is interesting, and I don't yet understand how it should work.
    2) I have different rules for different columns, and I assume this means that I should've changed your formula to adopt it for each rules.
    3) Still, it didn't work, because when I did add a row, the process I described in my original post repeated. Also, as you said, when I added the =Priority (I also tried adding the formula itself) to Applies to in conditional formatting, it immediately turned back to the range I had in Applies to. But remembering your words, I moved on, added the row, but, no, that didn't work out. )
    Last edited by Vitalite; 08-13-2017 at 05:49 AM.

  4. #4
    Forum Contributor
    Join Date
    05-20-2017
    Location
    Boston, US
    MS-Off Ver
    Mac 2011
    Posts
    139

    Re: Conditional formatting: adding rows adds additional conditions; how to avoid that?

    I have found the brilliant template created by Vertex42 - a masterpiece, at least to me, who is just learning. )
    In it, whenever you add any row to any part of any sheet of the workbook, the conditional formatting rules' ranges neatly increment by the amount of rows you added, and do not create new rules for any added row (the problem I have in my file).
    How did they achieve that?
    Attached Files Attached Files

  5. #5
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Conditional formatting: adding rows adds additional conditions; how to avoid that?

    There is an explanation in the first sheet.

    Conditional Format is in : general => conditional format.

    There is an option to edit the rules.

    There you can find also the formuala that rules the conditional format.
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  6. #6
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 365 version 2501
    Posts
    18,855

    Re: Conditional formatting: adding rows adds additional conditions; how to avoid that?

    Here is a copy of the file attached to post #1, perhaps looking at the setup of the named range and conditional formatting will be helpful. If the applies to doesn't change when you insert and/or delete rows then I suppose that it could be a difference between versions.
    Attached Files Attached Files

  7. #7
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 365 version 2501
    Posts
    18,855

    Re: Conditional formatting: adding rows adds additional conditions; how to avoid that?

    Perhaps using the following formula for the 'Refers to:', as prescribed in this article, would work better:
    Formula: copy to clipboard
    =OFFSET(TASKS!$F$12,0,0,COUNTA(TASKS!$A$12:$A$201),1)

    Let us know if you have any questions.
    Attached Files Attached Files

  8. #8
    Forum Contributor
    Join Date
    05-20-2017
    Location
    Boston, US
    MS-Off Ver
    Mac 2011
    Posts
    139

    Re: Conditional formatting: adding rows adds additional conditions; how to avoid that?

    Quote Originally Posted by JeteMc View Post
    Perhaps using the following formula for the 'Refers to:', as prescribed in this article, would work better:
    Formula: copy to clipboard
    =OFFSET(TASKS!$F$12,0,0,COUNTA(TASKS!$A$12:$A$201),1)

    Let us know if you have any questions.
    *Thank you very much for your suggestion. I decided to try at least on one rule and one column.
    I picked the rules for column N -> cells there should turn blue and values turn white, if the cell value = -1.
    In the applied to section I tried to use =OFFSET(TASKS!$N$12,0,0,COUNTA($N$12:$N$1000),1)
    When I clicked OK, nothing happened in the file, the values of cells = -1 didn't change their appearance.
    When I went back to Conditional formatting, the range in applied to was back to the initial one.

    I also tried with the defined name. Same result.

    If by any chance you have a bit of time to look at the vertex's file I attached previously, I would be grateful if you can explain how they achieved such formatting that:
    - no new rules are added, if you add rows, namely the new rules, corresponding to a newly added row, appears;
    - but rather the range's last cell is extended by the number of added rows.

    I don't understand what is incorrect in the way I have written rules, and how they have achieved such wonderful and correct formatting.
    Thank you very much!

  9. #9
    Forum Contributor
    Join Date
    05-20-2017
    Location
    Boston, US
    MS-Off Ver
    Mac 2011
    Posts
    139

    Re: Conditional formatting: adding rows adds additional conditions; how to avoid that?

    I deleted a few sheets from the example file I found, and left only two sheets. Also I have changed the rules by deleting any that depend on other sheets. Now there are only 2 sheets: Accounts, Transactions.

    In Transactions sheet I added two new rows 24 and 25, without copying any formatting and formulas. And the Applied to range has correctly changed to account for two additional rows, thus it was rows 5:49, and became rows 5:51. No additional rules were added. So it is obvious that I do something truly wrong in my file, as I can't get the same correct outcome, but do get new rules added as I add new rows.
    Attached Files Attached Files

  10. #10
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 365 version 2501
    Posts
    18,855

    Re: Conditional formatting: adding rows adds additional conditions; how to avoid that?

    Try this modification to the OFFSET based formula: =OFFSET(TASKS!$N$12,0,0,COUNTA($A$12:$A$1000),1)
    Notice that the argument for COUNTA is coming from the cells in column A because all of the cells within column A of the 'Table' will be counted, whereas in the formula shown in post #8 references the cells in column N which may or may not be counted depending on whether they contain anything (i.e. N15:N24 are blank). I hope that this makes sense.
    Let us know if you have any questions.

  11. #11
    Forum Contributor
    Join Date
    05-20-2017
    Location
    Boston, US
    MS-Off Ver
    Mac 2011
    Posts
    139

    Re: Conditional formatting: adding rows adds additional conditions; how to avoid that?

    I am truly sorry that it takes me so long to get back. I have been trying everything, and no, somehow it doesn't work, including using the OFFSET function in Applies To (or a defined name with the OFFSET function). 'Applies to' doesn't allow any other formatting of ranges except for usual highlighted ones.

    In a continuing effort to find the problem in my files, I have created two files once again (formatting_quns is the initial one; formatting_quns_2 is the changed one). And here is what I did and what happens as a result.
    The initial range was from row 12 to row 41.
    Screen Shot 2017-08-21 at 5.29.55 PM.png

    1) highlighted rows 19 - 20
    2) clicked Insert, and inserted 2 rows; now new 19 and 20 empty rows are added
    3) copied row 18
    4) inserted the copied row into both new row 19 and 20

    All these steps changed the initial range by breaking it down into 2 blocks: first block from row 12 till row 18, and second from row 21 to row 43.
    And added new conditional rules for inserted rows 19 and 20.
    Screen Shot 2017-08-21 at 5.33.44 PM.png

    Screen Shot 2017-08-21 at 5.34.41 PM.png

    This happens constantly.
    Using offset function sounds truly helpful, but Applied to doesn't allow that.

    It seems that I am doing something wrong, and/or miss some basic understanding. These issues do not occur in the vertex's file I showed as an example of perfectly working conditional formatting.
    Attached Files Attached Files

+ 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. Additional Conditions for Conditional Formatting
    By David McRitchie in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-06-2005, 11:05 AM
  2. Additional Conditions for Conditional Formatting
    By David McRitchie in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-06-2005, 07:05 AM
  3. Additional Conditions for Conditional Formatting
    By David McRitchie in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-06-2005, 04:05 AM
  4. Additional Conditions for Conditional Formatting
    By eric beck in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 AM
  5. [SOLVED] Additional Conditions for Conditional Formatting
    By eric beck in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 01:05 AM
  6. Additional Conditions for Conditional Formatting
    By eric beck in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 AM
  7. Additional Conditions for Conditional Formatting
    By eric beck in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 10:05 PM
  8. [SOLVED] Additional Conditions for Conditional Formatting
    By eric beck in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-25-2005, 02:05 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