+ Reply to Thread
Results 1 to 9 of 9

Conditional Formatting to Highlight a Range when Today is between Two Dates DD/MM

  1. #1
    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,448

    Conditional Formatting to Highlight a Range when Today is between Two Dates DD/MM

    Afternoon, all!

    I'm scratching my head and wondering if this is possible using a conditional formatting formula: I want to highlight a range of cells based on today being between two non-year-specific dates (e.g. between 01 January and 14 February, and the range would be highlighted between those dates every year). I want to specify the dates in the formula, not in cells on the worksheet. Is it possible to do this? I hope I've made the query clear!
    Last edited by AliGW; 12-04-2015 at 02:25 AM. Reason: Solved!
    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.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,698

    Re: Conditional Formatting to Highlight a Range when Today is between Two Dates DD/MM

    want to specify the dates in the formula, not in cells on the worksheet.
    Not entirely sure what you mean by that, and I don't even recommend it. But if you mean that you want those dates to be baked into your conditional formatting formulas, then here is your CF formula:

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    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,448

    Re: Conditional Formatting to Highlight a Range when Today is between Two Dates DD/MM

    Quote Originally Posted by 6StringJazzer View Post
    Not entirely sure what you mean by that, and I don't even recommend it. But if you mean that you want those dates to be baked into your conditional formatting formulas, then here is your CF formula:

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Thanks for your response, but I have two questions:

    1. Why do you recommend not doing this via a conditional formatting formula?
    2. Why have you given a cell reference? Perhaps I wasn't clear: I simply want the formula to determine whether today() is between two dates (without the year) and format the cells if that condition is true. The formula you have given is rejected if I copy it into the conditional formatting dialog - too many arguments.

  4. #4
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,532

    Re: Conditional Formatting to Highlight a Range when Today is between Two Dates DD/MM

    If I understand what you mean by "range would be highlighted between those dates every year" then it seems like 6StringJazzer's formula will work fine in Conditional Fomatting, although it is missing a ")" after the first TODAY function call. Here is the formula with that modification:
    Please Login or Register  to view this content.
    Here is the formula applied to a range of dates:
    CF a range of dates.xlsx
    If I am missing the point then perhaps attaching a spreadsheet will help make the query clearer.
    Let me 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.

  5. #5
    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,448

    Re: Conditional Formatting to Highlight a Range when Today is between Two Dates DD/MM

    Unfortunately, I don't have a spreadsheet to attach, as this is currently just a concept! It's pretty obvious that I'm not making myself clear, and I apologise for this. Let me try again!

    Suppose you have three columns in a spreadsheet for data entry: one is to be used between 01 Jan and 14 Feb, the second is to be used between 15 Feb and 31 March and the third between 01 April and 15 June. All I want to do using conditional formatting is to highlight (i.e. fill with a colour) the cells in the column that is current. There are no dates anywhere on the spreadsheet. Does this seem any clearer? If not, I'll create a sample showing the sort of thing I want.

    Thanks for your patience!

  6. #6
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,532

    Re: Conditional Formatting to Highlight a Range when Today is between Two Dates DD/MM

    My take is that you want column A to be highlighted if today's date is between 01 Jan and 14 Feb, column B to be highlighted if today's date is between 15 Feb and 31 March, etc. Take a look at this file (does have dates in the first two rows of each column) which employees the CF formula:
    Please Login or Register  to view this content.
    CF a range of dates.xlsx

    Without using any dates it seems to me like that would would require VBA with code something like IF(AND(TODAY()>= 1 Jan,TODAY()<= 14 Feb), apply fill to all non-blank cells in column A, IF...
    I am not familiar enough with VBA to go further than just my conceptualization of how this might be done.

    Let me know if you have any questions.

  7. #7
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,698

    Re: Conditional Formatting to Highlight a Range when Today is between Two Dates DD/MM

    Quote Originally Posted by AliGW View Post
    Let me try again!
    That is much clearer than your original description, thanks.

    First, doing this with conditional formatting is fine. What I don't recommend is that you put dates directly in your formulas and have no dates in your file. That is because if you ever need to change anything, it is much easier to change your worksheet than to edit conditional formatting formulas.

    This is the conditional formatting formula for the first column. Unfortunately you won't be able to test it until New Year's Day :-)
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Simply use the same format and copy the formula to use in the other columns, changing the dates appropriately.


    But here is the way I would do it. See attached file. This method allows you to use a single conditional formatting rule, instead of one for each column. And if your period dates change, it's a quick change to the spreadsheet. highlight current column.xlsx

    Added: Regarding JeteMc's suggestion, you can see by my formula above that VBA is not required; it can be done with CF. Also, I looked at JeteMc's file, which is very similar to my preferred solution, although is still sensitive as to the year. My version works no matter what year it is.
    Last edited by 6StringJazzer; 12-03-2015 at 04:49 PM. Reason: Added blue text

  8. #8
    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,448

    Re: Conditional Formatting to Highlight a Range when Today is between Two Dates DD/MM

    Thank you both very much for your replies! 6StringJazzer has hit the nail on the head, and the CF formula works beautifully for what I require. I use a lot of CF in my tracking workbooks, as we use a traffic light system to show the progress our students are making, so I'm perfectly happy editing CF formulae, and having the dates on the sheet itself (or anywhere in the workbook) was not my preferred solution. Thanks again!

  9. #9
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,698

    Re: Conditional Formatting to Highlight a Range when Today is between Two Dates DD/MM

    You're welcome! Thanks for the rep, and thanks for marking your thread Solved!

+ 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 between two dates that are not today!
    By IreneADS in forum Excel General
    Replies: 12
    Last Post: 01-15-2014, 05:42 PM
  2. Replies: 5
    Last Post: 12-31-2013, 01:44 AM
  3. [SOLVED] Conditional formatting - highlight cell if it's empty 2 working days before today
    By uhtfgy in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-16-2013, 06:20 AM
  4. [SOLVED] Conditional Formatting of: dates within 1 month and dates before today.
    By Luke Smith in forum Excel General
    Replies: 5
    Last Post: 06-18-2013, 07:29 AM
  5. Conditional Formatting Formula to highlight TODAY
    By Jiptastic in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-30-2013, 10:42 AM
  6. Replies: 4
    Last Post: 02-13-2013, 01:18 PM
  7. Replies: 1
    Last Post: 01-24-2013, 04:52 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