Comments on: How to conditionally format dates and time in Excel with formulas and inbuilt rules

See how to apply Excel conditional formatting to dates. Learn how to use formulas to highlight weekends and holidays, format cells when a value is changed to a date, shade upcoming dates and delays, conditionally format dates based on the current date, and more. Continue reading

Comments page 2. Total comments: 739

  1. Now i need a help hope you would help me in our office we have a daily tracker in that we have 12 agents and works in 24/7 shifts we work on incident tickets as soon as the ticket arrives we have enter the ticket number in that sheet and change the color of the cell manually according to the time the ticket arrived for eg. if ticket came in between 8am to 9 am it will be green if it is between 9 am to 10 am then red if it is between 10 am to 11 am then purple so on so instead of changing the color manually i need a formula or a steps so based on current time when the data entered into a cell the color should change please suggest

    1. Hi! The above article contains all the information you need, so I hope you will read it. Use the TIME function to set the time. Here is an example of a conditional formatting formula for your question:

      =AND(A1>=TIME(9,0,0),A1<TIME(10,0,0))

      Create a separate conditional formatting rule for each time interval.

  2. Hello-How would I add conditional formating using an excel calendar template to highlight a Friday that is paydate if comparing to another worksheet that lists the pay dates

    1. Your title - "How to conditionally format dates and time in Excel" - is misleading. You have no examples dealing with formatting time values, just dates. I was looking for a simple way to format times in cells if they are between certain times of the day, say 8:00 AM & 5:00 PM. I can get it to work by storing these two values in some cells and then comparing against these but was looking for a way to conditionally format w/o having to store the two values in cells.

      1. Hi! Since the date and time in Excel are stored as numbers, you can get the time using mathematical functions. For example, using the INT function.

        A1-INT(A1)

        For conditional time formatting, you can use a formula like this:

        =(A1-INT(A1)) > TIME(14,0,0)

      2. actually the other way...5:00 PM & 8:00 AM.

  3. Hi I would like to highlight dates that are less than (X date) and greater than (X) date. I've been successful at highlighting in green (today and future datest) but i cant seem to add the second colour (red) for the dates in the past. Can you please help in how to formulate how to do this.

    I will be doing the same formula for other columns that dont have a set previous date but we want to highlight what is expired and what is up to date of the date when the excel report is generated. Thank you!

    1. Hi! You cannot add a second color to a conditional formatting rule. Create a separate conditional formatting rule for each color.

  4. I have a data entry sheet of 3 column. At column B I want to add goods name and at column C the quantity of goods. I want when I add goods name on column B entry date will auto generate on column A. Is it possible?

  5. Hello.

    Can you please help with the below example. Conditional formatting using 2 dates and 2 times.

    Date 1 (F7) and time 1 (G7) - Date 2 (N1) and time 2 (D7) - Highlight F7 if the start date and time is >26 hours after the end date and time

  6. Can you please advise what I am doing wrong here?
    I would like to highlight in green dates that are less than 21 days ago from today, yellow 21-40; red more than 40 days agp
    I am using the formulas
    Green: =Today()-$I3>21
    Yellow: =AND(TODAY()-$I3>=21,TODAY()-$I3=45
    This appears to be exactly what is pictured in the formulas above & i am not sure why it does not work
    It is in order green/yellow/red

    1. Hi! If I understand your task correctly, the following formula should work for you:

      Green: =Today()-$I3<21
      Yellow: =AND(TODAY()-$I3>=21,TODAY()-$I3<=40)

  7. Hi! I have been tasked to conditional format a cell that did not occur yet, like:
    Highlight dates that has not been occurring.

    1. Hi! Compare dates to the current date using the TODAY() function. Read this section carefully: Conditionally format dates based on the current date.

  8. I want to remove from this 2024-01-03T08:25:32.307+01:00 and use time only

    1. Hi! To extract the time from the text, use the SEARCH function to find the number of the position of the letter "T" after which the time is written. Then use the MID function to extract the time and use the TIMEVALUE function to convert the text string into a time value.
      Try this formula:

      =TIMEVALUE(MID(A1,SEARCH("T",A1)+1,8))

  9. Hi! I have a sheet that has discharge dates. We need to follow up with the patients at 24hours, 1 week, and 15-30 days. I need to highlight blank cells in column b when there is a value in column a based on 24 hours for column b, 1 week for column c and 15-30 days for column d. Formulas I input do not seem to work. Is this possible to have a sheet with this information?

  10. Hi!
    Would you be able to help me with the below?
    I want to highlight the date when it's in the last 7 days (which i managed to get =IF($G2<=TODAY()+7) but then if the status (selected from a drop down)in column I = Completed or closed, I don't need it be highlighted as no action is needed

    thansk in advance!
    Sabine

      1. thanks!

  11. I am in sales and i prepared a list of customers. I want to highlight the row that contains the customer name & from august till today the list is increasing. I want that after every 10 days the customers not been contacted can highlight the names that are due to be contacted.
    Please help.
    Thanks

    1. Hi! If you have a column with contact dates and a column with the date the customer was added, use the recommendations in this article to highlight the names that are due to be contacted.
      For example, C1 - contact date, B1 - date of addition:

      =AND(ISBLANK(C1),TODAY()-B1>10)

  12. Hi, I have dates in column B, I want to highlight 2 days before date from todays date but dont want to include if holiday or weekend falls in betweek. I want to highlight only working days.

    COP Date
    9/7/2023
    12/4/2023
    12/12/2023
    12/15/2023
    12/12/2023
    12/12/2023
    12/14/2023

    1. Hi! To count working days between 2 dates, use NETWORKDAYS.INTL function. For example,

      NETWORKDAYS.INTL(A1,TODAY(),1)<=2

      But you cannot specify how many cells to highlight in conditional formatting. All cells that match the condition will be highlighted.

  13. Hello,

    Would you please help me to understand it better?
    I have a table from from B10 to Q200 - where Colum K has dates and Colum L has prices.
    I need to highlight a row where price ="" and date =In less than 7 days

    I'm using this formula, but it only works for 1 row:
    =AND($K$10-TODAY()>=1, $K$10-TODAY()<7, $L$10="")

    How do I make it work for the whole table?
    Please help

  14. Hello,

    I'd like to set conditional formatting on a cell by % complete within a date rage.
    Example would be:

    Initial Target Complete   % Complete Status
    11/27/2023 100% Blue
    12/15/2023 65% Yellow
    12/06/2023 30% Red

    If within 7 days of target completion date and % Complete is below 50% cell turns red
    If within 7 days of target completion date and % Complete above 50% below 76% cell turns yellow
    If within 7 days of target completion date and % Complete is above 75% and below 100% cell turns green
    If % Complete is 100% cell turns Blue

    Any assistance you could give would be greatly appreciated.

  15. I understand how to conditionally format based on a specific date by using it's numerical value. However, how to I set a conditional format based on the whether the date in one column is before or after a date in another column. For example, if one column is the approval date and another is the review date, I want to highlight when the review date is after the approval date. I tried just using B2>D2, but that didn't return the conditioned format.

    1. Hi! If your dates are written as date rather than text, the conditional formatting formula =B2<D2 should work. B2 - is approval date.

  16. I'm trying to get a cell containing a month (listed as 11/01/2023 - 11/30/2023) to turn green if it contains today's date in that whole range of dates. I've already got my initial cell set up with = today() and it's working, but the existing date conditional formatting options are all about being before or after today, and I tried the is equal to today option but it didn't work (i think because I'm listing a range rather than each day in the month separately). I'm thinking I need to use the conditional formatting based on a formula setting but I'm not sure what formula to use. I'm open to putting the first day of the month and the last in separate cells, but listing every day somewhere would be difficult. Any help would be appreciated!

    1. Hi! Specify the month number and select the cells where the date corresponds to this month. Use the MONTH function to find the month number by date.
      You can also try the formulas from this paragraph above: How to highlight dates within a date range.

  17. Hello,

    i have a sheet containing end date for warranties and i need to creat a conditional formating rule with a formula to indicate when the date is 2 months out.

    I have tried =$A2-TODAY()>60 but it does not seem to be working. it is highligning the wrong cells.

    How can i solve the issue? Is there a formula that would be better suited for my needs?

    thank you!

    1. Hi! In a conditional formatting formula, use the cell reference in the first row, even if the conditional formatting range begins on the second row.

      =$A1-TODAY()>60

  18. I am looking to create

    Moved to Outcome 1 Month Due Verified Amount
    18-Aug-23 18-Sep-23 Y $123.00
    25-Aug-23 25-Sep-23 P $456.00
    31-Aug-23 30-Sep-23 N $789.00

    The values in the cells in the "1 Month Due" column are calculated based on the values in the "Moved to Outcome" column using the "=EDATE (F2, 1)" formula, where F2 holds the "Moved to Outcome" date.

    I want to format things so when the value showing the "1 Month Due" column is 1 week past the current date, the cells in the "1 Month Due", "Verified" and "Amount" columns turn orange, and when the date in the "1 Month Due" column is 1 week or more past the current date, the cells turn red.

    In addition, I would also like to have the cells the "1 Month Due", "Verified" and "Amount" columns changed based on the value in the "Verified" column.
    I have set up the conditional formatting in the "Verified" column so that a cell containing a "Y" turns green, a cell containing a "P" turns yellow, and a cell containing a "N" turns red. I would like this to apply to the "1 Month Due" and "Amount" columns as well, and to override the conditioning based mentioned above (based on the "1 Month Due" condition).

    I hope that makes sense, and thanks very much, in advance, for any assistance you can provide - this one has been a real noodle-scratcher for me :)

  19. Hello!

    I have a matrix for health tests. I can't seem to get past the last month/next month issue. I need anyone who is out of date to go red but cannot work out how to do this past last month (I basically need last month and previous)

    Any ideas? :)

    1. Hello! I hope you have studied the recommendations in the tutorial above. Unfortunately, your information is not enough to recommend a conditional formatting formula to you. How do you determine "out of date"? Do you want to highlight with color only the current and last month's dates? Describe the problem in more detail.

  20. I'm looking to pull data from one tab (which is a big list of information) into a summary on another tab. I want to display the name (B2), sub-name (C2) and date due (Q2) within a 21 day window (so it will show everything due within the next 3 weeks, based on today's date). Struggling to find a formula that will do this but I'm sure I've seen it elsewhere before. Thanks

  21. Hi,
    I have a spreadsheet containing dates of Insurances.
    I have conditional formatting for anything from today to highlight in red. So I know that they have expired.
    I am now wanting to add in another conditional formatting for any that are due to expire in the next 2 weeks from 'today' I have tried with a formula of '=AND($D2-TODAY()>=0,$D2-TODAY()<=14)' but is it highlighting insurances that are expiring in 2024.

    Please can anyone advise where I am going wrong?

    Thanks

    1. Hi! I'm not quite sure what the problem is with this formula. It returns TRUE for a future date no more than 14 days from now. Currently, this conditional formatting formula cannot highlight 2024 dates.

  22. I have a spreadsheet with a list of documents my team needs to review. Whenever the documents are revised, it gets updated on the spreadsheet. I set up the conditional formatting highlight the employees cell green if their review is later than the revision and red if it's prior to the revision. I am facing two problems.
    1. If I create the conditions for both in the topmost cell and drag it down to the last cell they all use the first reference cell to compare, even if I take out the $,( i.e. change $B$5 to B5).
    2. If I create a CF formula for each cell individually, aside from taking forever, it also returned a different result in the second cell, even though the conditions were exactly the same as the first cell.

    Thank you

  23. I have a spreadsheet covering events over a 3-month timeframe.

    I'd like to highlight rows based on the date the event occurred. There may be one or more rows with one date.

    Example: my spreadsheet has 133 rows of data for dates from 01 Jun through 31 Aug. Three rows have events that occurred on 01 Jun; One row with an event that occurred on 02 Jun; No events occurred on 03, 04, or 05 Jun; Eight rows for events that occurred on 06 Jun; etc.

    Is it possible to define conditional formatting that will highlight the 3 rows for 01 Jun with a different color that the one row for 02 Jun and yet another color for the 8 rows for 06 Jun?

      1. That is not helpful. It'd be faster to filter by date and add color to the rows that appear for each date.

  24. Hi, I am trying to come up with conditional formatting rule that applies to a cell with a completion date that is past the due date listed in another cell. For example, say the "June By Date" is 6/1/23 in cell O3 and "June Completion Date" is listed as 6/9/23, that cell would then be formatted. I am running into the issue of applying this to all rows in that table.

  25. Hi!
    I have put on an alarm sound VBA code and saved it on the spreadsheet that I want to use it for.
    The spreadsheet is so that the alarm sound must go off every second day from the dates that I put in. The problem is I don't know what formula to use and how to set it to go off every second day.

  26. I would like to highlight the date in C1 if the date in A1 is more than one calendar month. Not necessarily 30 days. For example, A1 is 01/19/23 and C1 is 02/23/23. Over 30 days are between these dates, but a calendar month has not been skipped, so I do not want C1 highlighted.

      1. I apologize, I didn't explain what I wanted well. I would like C1 highlighted if a month was skipped. So A1 is a date in January, if C1 is a date in March, skipping February, I would like it highlighted. I tried the YM code, but, alas, it works on days, even though Excel Help said it ignored days and only looked at the month.

          1. That did work. Thank you!

  27. Hi,

    I have a calendar in excel, I need to highlight two cells ( cell 1 = today's date and cell 2 = the adjacent cell below cell 1) been looking how to do this, but cant find an answer. Hope you can help me

    Highlighting today's date is quite easy, what I find difficult is highlighting the cell 2

    Thank you in advance

      1. Thank you very much for your help

  28. Hi

    I'm trying to change the cell colour to reflect length of service e.g under 2 years (red), over 2 years (orange) and over 5 years (green).

    I am using the following formula to show the service length - =DATEDIF(E2,G2,"y")&" Years, "&DATEDIF(E2,G2,"ym")&" Months" - which shows as 4 years, 2 months. Is it possible to do cell colouring when it has both words and numbers?

    Thanks

  29. Hi, I'm working on a project and would like any task end dates (in column L) to highlight red once they're overdue but only if the task status (in column I) does not include the text "Completed". Could you help please?

    1. Hi! If I understand your task correctly, the following formula should work for you:

      =(ISNUMBER(SEARCH("Completed",I1)))*(L1How to find substring in Excel

  30. I need to highlight a cell if it is 2+ days past another certain cell. I have a list of dates in different columns and if the date in one column is 2 or greater than the cell to the left of it I want it to highlight. Is this possible?

  31. Hey

    I want to highlight "tomorrow" in excel. But: when tomorrow is a saturday or a sunday, i want it to highlight the first monday instead
    (= i always want to highlight the next working day)

    If today is friday 11/08/2023, then i want monday 14/08/2023 to be highlighted
    if today is monday 14/08/2023, then i want tuesday 15/08/2023 to be highlighted

    can you help me out please?

  32. I'm trying to find a formula where the cell turns in different colors:
    Each cell has a date (example: 28/04/2016 - typed in cell D3), if 4 years and 6 months passed, it needs to turn orange. But is 5 years passed it needs to turn red.

    Can someone help me with the right formula?

      1. If i try this, i always get this:
        "There's a problem with this formula. Not trying to type a formula? When the first character is an equal ('=') or minus ('-') sign, Excel thinks it's a formula:
        * you type: = 1+1, cell shows: 2
        To get around this, type an apostrophe (') first:
        * you type: '=1+, cell shows: =1+1

  33. Hello!

    I am trying to have a cell turn red if the date is less than or equal to todays date, but I don't know the right formula.
    I tried using the conditional formatting rule: Cell Value <= TODAY()
    But, when I delete a date from that cell, it still shows a red fill color and I don't know how to remove it. Is there any way to remove the color if the cell is blank or do I need a different formula?

    Thank you so much for your time!

  34. I need to highlight cells based on its value (date), to identify whether thats expired or not ;

    where expiry criteria defined in a single master cell of that column (i.e. 2 years, 1 year etc)

    For example
    H column is representing a course

    H100 = "1-JAN-2022"
    Expiry of H column items (course validity) is in cell H3 = "2 Years"

    There will be many rows of H, as well as other columns to mark validity in the same format

    Can anyone guide?

  35. Hi

    Im looking for a function to do the next.
    every 15th of the month I want a specific cell to decrease by 1 permanently.
    all the things I tried turned back to the origianl once the date turned to the 16th.

    please help

    tnx :)

  36. I am looking to make a worksheet that will highlight a date if it is earlier than a specific date of the month. For instance, we have a check to do every month from the 16th of every month. I would like to be able for a cell to turn red if the date in it is earlier than the 16th of that month

    1. Hi! Create the target dates with the DATE function. Get the current month and year using the MONTH and YEAR functions.
      If I understand your task correctly, try the following formula:

      =AND(D1=DATE(YEAR(D1),MONTH(D1),1))

  37. Hi, Alexander, Who how link the second excel data to the first excel, when I update the new date? immediately, just change only a week.

  38. Great information - but stops short of helping the beginner with coloring cells with date/time and leaving cells with text (PENDING) white. Would be really helpful if you explored the basic techniques for beginner to be able to master conditional formatting a cell to a color if there is a date time (period) vs. having the word PENDING. This complex issue is not covered, and when records are processed based on random date/times throughout the day you need to be able to highlight them. Hopefully, someone will report how to do that so I can apply it at my job. There is never training provided and receptionists are being tasked with more complex tasks daily. Would love support on this stuff. Thanks,

    1. Hi! You can use the CELL function to determine if a cell has a date in it. If I understand your task correctly, try the following formula:

      =LEFT(CELL("format",A1),1)="D"

  39. Probably a long shot but I'll ask! I'm using a =NOW() function to track the time elapsed, basically like a stop watch/stop the clock tracked in a spreadsheet of values. Currently formatted with =TEXT(CurrentTime-C10,"hh:mm:ss"). Two part question: The biggest question though is, is there a way to highlight the cell once 10 minutes, 20 minutes, or 30 minutes have elapsed without using a macro? I've tried using the time formatting and the lowest you can get is by day, not by minutes.

    part two: This sheet is used by both US/UK employees, so one side sees it displayed in each time zone, but when dates are entered, it only tracks in the UK time frame. (Example: Time input in UK BST as: 10:13, elapsed time should be 11:08 (which is what UK employees see), but US employees see 19:11:08, based on the time zone and the =NOW. Is there anyway to format that better?

    1. Hello! If you write the time as an unchangeable timestamp, you can apply conditional formatting to these cells using a formula:

      =AND(C1<>"",(NOW()-INT(NOW())-C1)>TIME(0,30,0))

      I recommend these guides on how to write the time in a cell: How to insert current time in Excel: timestamp shortcut, formula, VBA and How to insert today date & current time as unchangeable time stamp.
      If I understand the second question correctly, you may find this tutorial helpful: How to create a custom Excel date format for another locale.
      I hope it’ll be helpful.

      1. Thank you so much for your quick response, I will give both these guides a look and try your formula!

  40. I am tracking attendance and I want to show a two year rolling date range. Meaning after two years the absence is no longer in their file. Once the absence is "out of range" I want it to no longer be on the spreadsheet. Additionally I want the recent 12 months one color and the subsequent 12 months a different. How do I format that?

    1. Hi! To highlight dates greater than 12 months from the current date, you can use the conditional formatting formula with the DATEDIF function
      For example,

      =DATEDIF(A1,TODAY(),"m")>12

      You cannot use Excel formulas to delete any data from the worksheet. You can do it manually or with a VBA macro. You can use an Excel filter to hide unnecessary data.

  41. Trying to format a spreadsheet - work in doctors surgery.
    Spreadsheet contains name, nhs no, date of death, date of birth, age and 6 other columns - I want to highlight a row based on the date of death being in the past month but whatever I use either highlights only the date of death cell or the whole spreadsheet.
    Help please

    1. Hi! Highlight rows starting from row 2 and below as needed. Create a conditional formatting rule for the selected rows using a formula:

      =MONTH(TODAY())-MONTH($C2)=1

      You can learn more about change the row color based on cell value in Excel in this article on our blog.

  42. I've tried several things above, but conditional formatting just isn't working like I want it to. I have a spreadsheet with Month Names across the top. I randomly put numbers (not dates) in the rows below. What I want to accomplish is highlighting the current month column all the way down. So since TODAY is in May, I want to highlight the May column in, say, green and leave all the rest of the columns white. Once it turns to June, I want June highlighted all the way down. Is there a way to do this with conditional formatting? I've tried using the something like =Text(Today(), "mmmm") = B$1 (and vice-versa =B$1 = Text(Today(), "mmmm"). No formatting happens. Any ideas for me??

    April May June July
    $28.89 $20.15

    $30.85 $30.85
    $29.60

  43. Dear Sir,
    I have 2 issues.
    1. Have XLs in which 3 colums idicate date of completion, how I can highlight earloest date in each raw?
    2. In next column next action date written.
    I want to compare it with above earliest date and if it is late , how can I highlight that cells?

  44. Hi Alex,

    It would so helpful if you could help me in sorting out the steps

    A2= "=Today()" for ex. we can take it has 4/29/2023
    B2(Start date) = 4/25/2023
    C2(End Date) = 4/29/2023

    D2 = I need to validate the formula which is
    IF(A2= B2, it should "Delivering",
    IF(A2> C2,"Completed")))),

    Here am not getting the status as completed when date(C2) is actually completed

  45. I would like to create a yearly calendar (2023) month by month. I have completed this on my own manually, however, it took a long time. I am wondering if you have a template?

  46. I am hoping you can help with a formula.

    In column A, I have a date in which an account entered a work queue. In column L I have different statuses in a list. I want the status to automatically change to "Proceed with Write-off - Status Unchanged" if the account has remained unworked for 14 days.

    Also, the statuses are pulling from another spreadsheet in this workbook "Column Options" and are located in Q2-Q7.

  47. Hi there,

    Hope you can help.

    I have a dynamic calendar excel template with drop down list of months. Need to highlight certain days of a particular months, but it keeps highlighting those same days across all months. How do I break the link so that it highlights what I choose in a month, not same day in every month?

    Hope I am making sense.

    Thanks,

  48. I have a spread sheet that already has the autodate generated in cells A2 and A27. Now I'd like to have the deposit numbers in cell B1 and B26 increase by 2 digits automatically when the document opens just like the autdate. For example, let's say my deposit numbers for today April 13, 2023 are K105 (B1) and K108 (B26). I'd like to open the spreadsheet tomorrow, have the current date along with cells B1 and B26 showing K107 and K110, the day's deposit numbers.

    Kindest Regards

    1. Hi!
      If I got you right, the formula below will help you with your task:

      ="K"&(105+(TODAY()-DATE(2023,4,13))*2)

  49. So I work at a prison and have a worksheet that tracks dates for inmate reviews based on the date they entered our unit. They need to be reviewed once every 7 days for the first 2 months, then once per month after that (this part I have covered). We have our meetings to review on Tuesdays and Fridays. So the review periods go from Friday-Monday and from Tuesday-Thursday. So for this week the dates for review periods would be 04/07/23-04/10/23 and 04/11/23-04/13/23. Do you know how to have dates that fall into these review periods automatically highlighted as we are in them and when they will be the next review period. Thanks! :)

    1. Hi!
      I'm not quite sure what dates you want to be highlighted. The dates you specified are the entire week of 04/07/23 to 04/13/23. Please describe your problem in more detail.

      1. OK. The dates I provided are just an example using the current week. I need dates that fall on Fridays-Mondays and Tuesdays-Thursdays separately highlighted, but also only highlighted when we are within that timeframe and when they will be the next period. So for example, today is Wednesday the 12th, so we would currently be in the Tuesday-Thursday period. So I would want any dates appearing in that period to be highlighted (in say green). And the next period would be Friday-Monday starting on the 14th. I would want dates that fall into that next period highlighted differently (say orange) to let me easily see that they are upcoming. Once we reach Friday, then the Friday-Monday period would then be green and the upcoming Tuesday-Thursday period would be orange. And so on.

        1. Hi!
          A conditional formatting formula to highlight the days Tuesday through Thursday:

          =AND(WEEKDAY(A1,12)<4,ABS(TODAY()-A1)<3)

          You can learn more about WEEKDAY function in Excel in this article on our blog.

  50. Hello,

    I am trying to format a cell once a date has expired. Specifically, on 10/1/2023 I need every date that was entered in a column, that has passed to change format. However, I am trying to avoid just writing a new conditional format rule on 10/1/2023. Instead I would prefer the formatting indicate what has passed. Also I would like to keep it moving forward for the end of each fiscal year.

    1. Hi!
      You can see all the possible ways for conditional date formatting above. You can use a reference to the cell with the desired date in the formula so that you don't have to change the formula manually.

Post a comment



Thanks for your comment! Please note that all comments are pre-moderated, and off-topic ones may be deleted.
For faster help, please keep your question clear and concise. While we can't guarantee a reply to every question, we'll do our best to respond :)