Closed Thread
Results 1 to 14 of 14

conditional format with "applies to" that changes

  1. #1
    Forum Contributor
    Join Date
    03-10-2017
    Location
    USA
    MS-Off Ver
    office 2016
    Posts
    393

    conditional format with "applies to" that changes

    Im trying to find a way to change the area that conditional formatting applies to automatically. I have a sheet that has data on it and I often add data to it from time to time and would like the conditional formatting to change with it automatically instead of me having to change the "applies to" range manually if possible.

    for example if I have conditional formatting that applies to D2:AE200 and I add more data at row 201 can it see that was added and change the range.

    I would just make the range larger than I need but i also use sort often and if the range is larger it sorts the empty rows as well.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: conditional format with "applies to" that changes

    You could create a dynamic named range and then use that for the 'applies to' range rather than a hard-coded range.
    If posting code please use code tags, see here.

  3. #3
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: conditional format with "applies to" that changes

    The easiest way to do this is to put your data into an Excel table. http://www.utteraccess.com/wiki/Tables_in_Excel.

    One of the benefits of an Excel table is that it "copies down" formulas, formats (including conditional formats) and validation. So when you create the Conditional formatting, highlight the data (exclude the header) in the column. Then when you look at the conditional formatting later, one of the options is to show formats that apply to the table. These range will show the sheet values in the Conditional Format box, but internally it's linked to the table column so if you add or subtract data and go back, you will see the sheet addressed still match the table column.

    P.S. Also what Norie said.
    Last edited by dflak; 05-08-2017 at 04:18 PM. Reason: Add PS
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: conditional format with "applies to" that changes

    dflak

    Always forget about tables for this sort of thing - far easier option than setting up dynamic ranges, in my opinion anyway.

  5. #5
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: conditional format with "applies to" that changes

    I am a tables fanatic even when I don't need them.

  6. #6
    Forum Contributor
    Join Date
    03-10-2017
    Location
    USA
    MS-Off Ver
    office 2016
    Posts
    393

    Re: conditional format with "applies to" that changes

    not sure a table would work with my setup but i'm also not familiar with tables. Here is an example of what I have. First page "working sheet" is where the data is put to look at. Second page "data" is where the data is. The data is constantly changing so I'm hoping to only change it in one place. In my version I have 3 other sheets that call on the data to use it. Im using =IF('data sheet'!A1:AB1="","",'data sheet'!A1:AB1) to pull the data from the data sheet to the "working sheet" automatically. Not sure if I'm explaining it right so here is the example.
    Attached Files Attached Files
    Last edited by kevinu; 05-08-2017 at 06:45 PM.

  7. #7
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: conditional format with "applies to" that changes

    A table could work, but in this case, it doesn't confer a big benefit since we need to cover both rows and columns. Norie's on the right track with a dynamic name here except that the range has to be found using VB.

    So the following program uses LastCell to find the bottom-most, right-most cell to define the range to apply the formatting to. It also makes use of a helper cell on a helper sheet (Cell A1 on Sheet CF_Cell) that contains the validation you want.

    It copies this cell and pastespecial formats to the computed range on the working sheet.
    Attached Files Attached Files

  8. #8
    Forum Contributor
    Join Date
    03-10-2017
    Location
    USA
    MS-Off Ver
    office 2016
    Posts
    393

    Re: conditional format with "applies to" that changes

    very cool thanks

  9. #9
    Registered User
    Join Date
    05-21-2014
    Posts
    92

    Re: conditional format with "applies to" that changes

    Quote Originally Posted by Norie View Post
    You could create a dynamic named range and then use that for the 'applies to' range rather than a hard-coded range.
    Do the Office 365 & 2016 versions of Excel really allow for this? I only have Excel 2010 on hand, and that automatically converts any (dynamic or not) named range into an absolute reference range in "Applies to".
    I tried looking this up, but got nothing in the way of a firm confirmation. Anyone with newer Excel up to actually trying this suggestion out and seeing if the named range remains unconverted?
    Last edited by Monimonika; 05-09-2017 at 03:12 PM.

  10. #10
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: conditional format with "applies to" that changes

    Named dynamic range worked at least as far back as Excel 2003. That's when I used them.

    I wound up effectively creating a named dynamic range using VB in this case because I didn't know which row had the most amount of data. In a named dynamic range you usually determine how many rows and/or columns to include in the range using COUNTA - this assumes you pick the longest column or row and the the data are contiguous (no blank cells). In the case of your data, I needed to use LastCell to make sure I caught the longest row and column.

    Here is some information on dynamic ranges. They come in handy for formulas, data validation drop-down lists and dynamic charts.
    http://www.utteraccess.com/wiki/Offs...Dynamic_Ranges

  11. #11
    Registered User
    Join Date
    05-21-2014
    Posts
    92

    Re: conditional format with "applies to" that changes

    Quote Originally Posted by dflak View Post
    Named dynamic range worked at least as far back as Excel 2003. That's when I used them.
    Interesting how no one with a version of Excel higher than 2010 can respond whether or not they were able to use a dynamic named range (or even a simple named range) in the "Applies to" field. Even the one who first suggested it hasn't confirmed it with their own Excel version.
    From my online search elsewhere, all I get are threads where the dynamic named range gets presented as the solution, usually followed by the questioner saying it doesn't work in the "Applies to" field, and then the threads end there.
    Last edited by Monimonika; 05-11-2017 at 01:03 PM.

  12. #12
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: conditional format with "applies to" that changes

    The only reason a conventional named range would not work here is because there is not a convenient formula to find the longest row and the widest column. Normally, COUNTA accomplishes this

    =OFFSET(SheetName!A1,0,0,COUNTA(SheetName!AA),COUNTA(SheetName!1:1))

    However, we don't know if column A is the longest column or if it has gaps. Similar logic applies to using row 1.

  13. #13
    Registered User
    Join Date
    11-28-2012
    Location
    Kuala Lumpur
    MS-Off Ver
    Excel 2013
    Posts
    1

    Re: conditional format with "applies to" that changes

    I am using Excel 2013 and named range doesn't work in the "Applies to" field.

  14. #14
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,916

    Re: conditional format with "applies to" that changes

    Administrative Note:

    Welcome to the forum.

    We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original.

    Please see Forum Rule #4 about hijacking and start a new thread for your query.

    If you are not familiar with how to start a new thread see the FAQ: How to start a new thread
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

Closed Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. I broke conditional formatting! "Applies To" is blank?
    By Jeffcoleky in forum Excel General
    Replies: 13
    Last Post: 01-26-2016, 02:01 PM
  2. Replies: 2
    Last Post: 11-03-2015, 07:08 AM
  3. Conditional Format "Applies To" Changes, Don't Want it To
    By aaallday in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-21-2015, 06:01 PM
  4. Return the conditional formatting "Applies to" range?
    By mansfin in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-24-2015, 08:25 AM
  5. Conditional Format "Applies To" When Adding Rows or Columns
    By robot.crasher in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 05-12-2015, 06:23 PM
  6. [SOLVED] Conditional formatting "applies to"
    By bentod in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-11-2014, 04:29 PM
  7. Replies: 2
    Last Post: 03-09-2010, 01:25 PM

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