+ Reply to Thread
Results 1 to 8 of 8

Conditional Formatting - Dates before 365 days EXCEPT last line

  1. #1
    Forum Contributor
    Join Date
    07-07-2014
    Location
    Nottingham
    MS-Off Ver
    Office 2016
    Posts
    355

    Conditional Formatting - Dates before 365 days EXCEPT last line

    I have conditionally formatted a worksheet with =$C6<=TODAY()-365, meaning that any lines with a date in Column C older than 1 year ago are filled with colour.

    Is there any way of allowing me to hide all of the coloured rows EXCEPT the last one, so I can identify that there is archived data hidden (I know the row count will be 1,2,3,4,5,26,27,28,29).

    So, I was thinking either:
    Conditionally format but make the final line a different colour some way so that I could use Filter/Filter by Colour and hide Fill Colour 1, Do not hide Fill Colour 2 or No Fill
    or
    If there is any way of using any of the alternative filter options to not hide everything, just all of the lines except the final coloured one

    There is no consistency between dates on differing tabs - it is for tracking absences from work - so would need to be a "one size fits all"

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,737

    Re: Conditional Formatting - Dates before 365 days EXCEPT last line

    So, if your rows are 1,2,3,4,5,26,27,28, and 29, do you only want row 29 to be visible, or row 5 also - this is not the last one, but is the last of a contiguous group.

    Off the top of my head I was thinking that you could put a formula in a column somewhere, e.g. column H, which is based around that CF formula (which will return TRUE or FALSE) but also includes another term to detect if it is the last one,although that might be difficult if you want both row 5 and row 29 to be visible. Anyway, continuing along those lines you could then filter based on the cells in row H.

    It would help if you attached a sample Excel workbook, as all we know from your description is that column C contains a date. The yellow banner at the top of the screen has details of how to do this.

    Hope this helps.

    Pete

  3. #3
    Forum Contributor
    Join Date
    07-07-2014
    Location
    Nottingham
    MS-Off Ver
    Office 2016
    Posts
    355

    Re: Conditional Formatting - Dates before 365 days EXCEPT last line

    Hi Pete.

    So, if I am off sick 20 times in the last 3 years I want all of the episodes that occurred over a year ago to be filled and then hidden. However, so i can readily see if I (or someone else on a different tab) was EVER off sick, I want the final filled row to remain visible.
    So, if 5 occurrences happened in the last 12 months, then I want FOURTEEN of the older occurrences to be hidden, not all 15.

    Hopefully that makes a little more sense?

    Note: I've edited the OP so hopefully one is attached now?
    Last edited by jeffreybrown; 01-27-2023 at 12:00 PM. Reason: Please don't quote whole posts!

  4. #4
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,737

    Re: Conditional Formatting - Dates before 365 days EXCEPT last line

    I can't see an attachment.

    Pete

  5. #5
    Forum Contributor
    Join Date
    07-07-2014
    Location
    Nottingham
    MS-Off Ver
    Office 2016
    Posts
    355

    Re: Conditional Formatting - Dates before 365 days EXCEPT last line

    there you go
    Attached Files Attached Files

  6. #6
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,737

    Re: Conditional Formatting - Dates before 365 days EXCEPT last line

    You can use this formula in J6:

    =IF(AND($C6<=TODAY()-365,COUNTIF($C$6:$C6,"<"&TODAY()-365)<COUNTIFS($C$6:$C$34,"<>",$C$6:$C$34,"<="&TODAY()-365)),"Hide","")

    and copy down to J34. Put a suitable heading in J5 (e.g. Display) and select the range J5:J34 then click on Data | Autofilter. Then in the filter drop-down in J5 you can unselect Hide, so that only blanks in that column are shown, which will include the final row which is older than 1 year. It is not a good idea to have a table next to the main table for Other Leave, as the hidden rows will also hide the rows of that table, so maybe you should move this to below the main table.

    Hope this helps.

    Pete

  7. #7
    Forum Contributor
    Join Date
    07-07-2014
    Location
    Nottingham
    MS-Off Ver
    Office 2016
    Posts
    355

    Re: Conditional Formatting - Dates before 365 days EXCEPT last line

    That is perfect. I am not going to ad d a header, and have "hide" in white text so that "hide" is hidden.

    I know what you mean about Other Leave - it was a workbook I inherited, so wanting to get other things polished off before i start to worry about that.

    Cheers for the help.

    Darryl

  8. #8
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,737

    Re: Conditional Formatting - Dates before 365 days EXCEPT last line

    You're welcome, and thanks for the rep.

    Pete

+ 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] Conditional formatting for dates within certain number of days
    By kcfungus in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-16-2021, 06:37 AM
  2. [SOLVED] Conditional formatting for expiration dates that are 30, 60, 90 and over 90 days out.
    By loglostlt in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-18-2019, 04:11 AM
  3. Conditional formatting cells, dates / # of days calculation
    By hcdexcel in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-17-2018, 02:21 PM
  4. Replies: 5
    Last Post: 04-08-2016, 03:36 PM
  5. [SOLVED] Conditional formatting for dates over 30 days, except if completed
    By PurplePaws in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 11-19-2015, 12:05 PM
  6. [SOLVED] Conditional formatting list of dates within last 90 days
    By damianberry in forum Excel General
    Replies: 2
    Last Post: 12-11-2012, 02:30 AM
  7. Replies: 4
    Last Post: 08-04-2011, 05:51 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