+ Reply to Thread
Results 1 to 9 of 9

How Can I: Highlight a Range of Cells Based on Dates?

  1. #1
    Registered User
    Join Date
    05-23-2013
    Location
    Brampton, ON
    MS-Off Ver
    Excel 2016
    Posts
    135

    Question How Can I: Highlight a Range of Cells Based on Dates?

    I am hoping that someone can help me solve a riddle regarding the best way to make this objective be reached:

    I have a range of empty cells.
    Each cell represents 1 week within a calendar year.
    Each row contains 52 cells (=1yr).
    There are 90 rows.

    I want to enter a starting date and then auto-highlight all of the weeks that occur between the start date and today, on that large range of cells described above.

    Not sure how to make something like that happen.
    Any ideas?

    Thanks guys!
    Attached Files Attached Files

  2. #2
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.84 (24041420))
    Posts
    8,750

    Re: How Can I: Highlight a Range of Cells Based on Dates?

    I have changed your dates to use weeknum()
    so we can see what the weeknumbers are
    and then use a conditional formatting to test those weeknumbers against the header grid and highlight if greater or = start and less than or = today()

    NOT sure what to do about each row that says year 1,2,3,
    how does that change

    Also note 2016 has Week53 25th Dec to 31st Dec
    Attached Files Attached Files
    Last edited by etaf; 12-12-2016 at 03:57 PM.
    Wayne
    if my assistance has helped, and only if you wish to , there is an "* Add Reputation" on the left hand side - you can add to my reputation here

    If you have a solution to your thread - Please mark your thread solved do the following: >
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Registered User
    Join Date
    05-23-2013
    Location
    Brampton, ON
    MS-Off Ver
    Excel 2016
    Posts
    135

    Re: How Can I: Highlight a Range of Cells Based on Dates?

    Quote Originally Posted by etaf View Post
    I have changed your dates to use weeknum()
    so we can see what the weeknumbers are
    and then use a conditional formatting to test those weeknumbers against the header grid and highlight if greater or = start and less than or = today()

    NOT sure what to do about each row that says year 1,2,3,
    how does that change

    Also note 2016 has Week53 25th Dec to 31st Dec
    Thanks for the file. What I see is the entire right side of the 90 year grid turns green. The goal here is to highlight all of the week markers (cells) that occurred between the start date (user-entered) and today. That's why there are 90 years in those rows. For example, if you entered December 12th 1986, then 30 years worth of cells in the 90 year grid would highlight, starting in row 3 and going down from there.

  4. #4
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.84 (24041420))
    Posts
    8,750

    Re: How Can I: Highlight a Range of Cells Based on Dates?

    does this work
    I have worked out the YEAR
    taken one from the other to get the number of ROWS to highlight
    BUT as the grid starts in row 3 Ihave added 2 in the conditional formatting formula

    so ROW() gives me the row number
    so test that row number against the difference of the years plus 2 to account for the rows starting at 3
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    05-23-2013
    Location
    Brampton, ON
    MS-Off Ver
    Excel 2016
    Posts
    135

    Re: How Can I: Highlight a Range of Cells Based on Dates?

    Quote Originally Posted by etaf View Post
    does this work
    I have worked out the YEAR
    taken one from the other to get the number of ROWS to highlight
    BUT as the grid starts in row 3 Ihave added 2 in the conditional formatting formula

    so ROW() gives me the row number
    so test that row number against the difference of the years plus 2 to account for the rows starting at 3
    I see that this is much better that the previous, but I don't understand by only the right half highlights in green... Is my Excel differently executing something?

  6. #6
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.84 (24041420))
    Posts
    8,750

    Re: How Can I: Highlight a Range of Cells Based on Dates?

    so you want row 3 - 1st year to start at week 26
    and then all the years in between to highlight all the row
    and then the last year to stop at the week that is today()

    is that correct ?

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,207

    Re: How Can I: Highlight a Range of Cells Based on Dates?

    Three rules:

    =AND(ROW()+1996=$BE$5,B$2>=$BD$5) for first year (1999)

    =(ROW()+1996<$BE$7) for 1997 to 2015 (in your example)

    =AND(ROW()+1996=$BE$7,$BD$7>=B$2) for final year

    ALL have same fill colour.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    05-23-2013
    Location
    Brampton, ON
    MS-Off Ver
    Excel 2016
    Posts
    135

    Re: How Can I: Highlight a Range of Cells Based on Dates?

    Hi there

    I am sorry, I just don't see your solution working out. I asked a friend who is not a user of this forum and he eventually put together this, which hits the mark.

    Thanks for the work, I appreciate it.
    Attached Files Attached Files

  9. #9
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.84 (24041420))
    Posts
    8,750

    Re: How Can I: Highlight a Range of Cells Based on Dates?

    glad you got it to work,
    on your first sample it just said year 1 - which i assumed was the same year as the start date
    which made it a lot more complicated to work out a formula for you , rather than a list of years in the rows on the sheet , which simplifies the requirement considerably

+ 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] Highlight Cells Based on Dates
    By pugsly8422 in forum Excel General
    Replies: 3
    Last Post: 01-27-2015, 01:09 PM
  2. [SOLVED] VBA help need to highlight the cells based on the dates and insert respective cell values.
    By krjoshi in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-24-2014, 11:14 PM
  3. Using Conditional Formatting to highlight cells based on approaching dates
    By BrutalExcel in forum Excel - New Users/Basics
    Replies: 11
    Last Post: 06-12-2013, 11:56 AM
  4. [SOLVED] Trying to get Excel to highlight cells based on assigned dates.
    By tatumrae in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 04-10-2013, 08:25 PM
  5. [SOLVED] Excel 2010 Conditional Formatting to Highlight input cells based on Dates
    By chrisb84 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-20-2013, 09:39 AM
  6. Replies: 4
    Last Post: 01-03-2013, 12:25 AM
  7. Highlight or colour a cell or cells based on cells in another range.
    By baffld in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-30-2012, 08:41 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