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: 1245

  1. Hi,
    Please assist me to get this answered.
    I have searched a lot with no results.
    I have a column that has dates formulated as 1/15/2016. I am asked to format the cells as Orange if that date falls on a Saturday or Sunday, and if it falls on Monday, to return as "1". How can I do that?
    I changed the date format to be (Friday, January 15, 2016), but then I do not know where to go?

    1. Hi! You can change the color of a cell depending on the day of the week using a conditional formatting formula. Use the WEEKDAY formula to do this. For example:

      =WEEKDAY(A1,2)>5

      However, either manually or using a VBA macro, you can change the date value to "1". Conditional formatting only changes the format, it does not change the value.

  2. Hi
    I am wanting to highlight times , that are not :00 , :15, :30, :45 in column C , using conditional formatting only as its an import from another sheet,
    i tried using unique but i am a little lost to making this work correctly
    eg
    Column A B C
    Wednesday 06:00 15:31
    Thursday 06:00 15:30
    Friday 06:00 15:47
    Saturday 00:00 00:00
    Sunday
    Monday 06:00 14:08
    Tuesday 06:00 15:30

    1. Hi! Use the MINUTE function to get the minutes from the time. To determine that the minutes are a multiple of 15, use the MOD function. In this case, the remainder of the division by 15 is 0. Create a conditional formatting formula in which the minutes are not a multiple of 15 and the remainder of the division by 15 is not 0.

      =MOD(MINUTE(C1),15)<>0

      1. thank you this worked perfectly

  3. Hello. I am working on a five-shift rotation calendar. The calendar covers the whole year. The calendar fills TODAY 's date cell with a chosen color. That works well.
    I would also like to fill five cells in the column directly below the date in a different color, to help the Shifts more easily identify who is on duty that day.
    I started trying to build a formula where if TODAY was anywhere in the column above, then these cells would highlight. But I can't seem to build a formula that will work.
    I wish I could post a Snagit (screenshot) of what I'm trying to accomplish.
    For example below, if today's date were 2, I would want the cells to the right of the shifts, below 2, to highlight.

    Date Columns
    2 3 4 5 6 7 8....
    etc...
    etc...
    Shift A NNNN
    Shift B DDD
    Shift C TTTT
    Shift D DDDD
    Shift E NNN

    1. Well, the columns I tried to manually build in my question didn't work out using spaces, and I can't edit it. The date columns should be shifted to right , as well as how D (day shift), N (night shift), and T (training) should line up.

  4. 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.

  5. Hi,

    I have a task to use conditional format for a field of date that did not occur yet. For example, I have a date in row J6 of 01/02/2024 and date in row K6 is 01/02/2027 (3 years later). My task is to make the row K6 to highlight automatically, lets say in red, when it has 30 days left until it reaches set date of 01/02/2027. Can you please advice how I can do this? I'm very new here...
    Thank you very much!

    1. Hi! Have you tried the methods described in this blog post? All the necessary information is in the article above. For example: K6-30<=TODAY()

  6. 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.

  7. I've been tasked to do a Staff report where employees training are highlighted with traffic lights. I have to see Green for first 9 months after training course, Amber for between 3 months and Due Date, and Red for Past the Due Date. How would I write these. It has to apply to 23 cells, but not all rows are populated due to training requirements. Not all staff need all courses.

    1. Hi! For each condition, create a separate conditional formatting rule as described in the article above. I cannot recommend these 3 formulas to you as I do not have your data. If something is still unclear, please feel free to ask.

  8. 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.

  9. 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?

  10. 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

  11. 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)

  12. 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.

  13. 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))

  14. 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?

  15. 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!

  16. Hi, I have a spreadsheet with 4 columns of data: Reval Due, License Due, Cert Due, DEA Due.
    I created a cell with today's date using = TODAY ()
    I would like the cells in each column to automatically highlight using 2 colors for the sets of data: yellow- what is due within 0-60 days from the current date; and then orange for dates 61-90 days out from the current date. This will allow me to see at a glance the upcoming due dates for each set of data. Once I complete the update I would assume when I put the new updated date the color will go back to no fill? (for ex: license due 2.1.24 so it would show yellow fill since it's within 30 days from today (1.15.24). Once I update the license and put the new due date of 2.1.25 it should drop the color and now has no fill color bc it is not due until the next year. Are you able to provide the steps to do this? Thank you!

    1. Hi! Create two conditional formatting rules. The first for yellow color, the second for orange color. All necessary information is available in the article above.

  17. Not sure why the formulas are not getting copied properly.

    =AND(TODAY()-$A3>=0, TODAY()-$A3<=30)

    1. Hi! Your formatting conditions are inconsistent and not very clear. If you want the cell not to be highlighted when 0 is written in column B, add another AND condition to the formula. For example:

      =AND(TODAY()-$A1>=0, TODAY()-$A1<=30, $B1<>0)

      1. Thank you Alexander, it is working now and got to know where my mistake was.

  18. Below are the formulas that I use:

    =AND(TODAY()-$A3>=0, TODAY()-$A330, TODAY()-$A390, TODAY()-$A3180

  19. I have a date in Column A and I want to colour column B, and C (it has got some numbers like 0,1,2, 3, etc) if the Column A is less than the current date. I am using the below formulas.
    =AND(TODAY()-$A3>=0, TODAY()-$A330, TODAY()-$A390, TODAY()-$A3180

    The first three formula works, however when it the B, and C column has a value 0 I don't want to colour anything and leave it as it is.
    But if in a row there are values like 1, 0 (Column B, and C)and the date is 12/09/2023 then both the cells are getting coloured.

  20. 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)

  21. 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.

  22. Thank you for the article - trying to use a conditional formatting to change the color based on time elapsed. For example if value in format hh:mm is between 00:01 and 06:00, green. If 06:01 to 12:00, yellow. 12:01 to 24:00 red. If > 24:01, dark red.

    Thank you!

  23. I created a vendor payment reminded with vendors detail, date of goods supply and payment due date.
    i would like to also create a column with the text "PAID" "UNPAID" highlighted in green or red after payment due date elapses.

  24. 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

  25. 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.

  26. 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.

  27. 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.

  28. 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

  29. 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 :)

  30. 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.

  31. 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

  32. I have a temp chart that is recorded on daily per month. Is there a way to highlight a missed day and/or missing element (multiple recordings on 1 day), and then lock that day so it can not be retro entered in? While I'm at it, on a separate sheet, I also have a daily task checklist on equipment that I'd like to have the same functions on if something is not recorded or a day missed. It also is a monthly calendar.

  33. I have a spreadsheet that I want to highlight when someone is expired. For example: Column B will be the date they completed the training, in column C I want the date they are due to do the training again. 2 year time frame. I want the cell highlighted (filled) so we can see the expired employees. Is this possible? I saw your example from above but I didn't think it would work for what I am trying to do.
    Thanks!

      1. Please advise, previously I have provided a weekly time column, for example week 1 to week 10, how to do it so that when I input some data it will automatically be forwarded to the column according to the time period I have provided.
        The place where I input the data does not change, only the results can be reflected in the time column according to the time entered. Thank You

  34. 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.

  35. 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

  36. 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.

  37. I have made a training matrix for staff at work, and want to highlight training that is in date as green, out of date (1 year after completion date) Red and due ( 11 months after completion date) orange.

  38. 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.

  39. 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.

  40. 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!

  41. 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

  42. 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

  43. Hi, i am creating a roster, what conditional formatting formula could i use to identify where someone has worked more than 11 shifts in a fortnight and identify the last night shift worked. i have plotted the roster using shift codes. Thanks

  44. 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

  45. 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?

  46. 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?

  47. Hi, i am trying to colour a cell when a date & time appear dd/mm/yyyy hh/mm is there a formular for this

  48. What formula would I use if I want to highlight dates from today that are more than 90 days in the future as green, from today to 90 days in the future as yellow, and dates in the past from today as red?

  49. 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

  50. 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!

Post a comment



Thank you for your comment!
When posting a question, please be very clear and concise. This will help us provide a quick and relevant solution to
your query. We cannot guarantee that we will answer every question, but we'll do our best :)