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

If you are a regular visitor of this blog, you've probably noticed a few articles covering different aspects of Excel conditional formatting. And now we will leverage this knowledge and create spreadsheets that differentiate between weekdays and weekends, highlight public holidays and display a coming deadline or delay. In other words, we are going to apply Excel conditional formatting to dates.

If you have some basic knowledge of Excel formulas, then you are most likely familiar with some of date and time functions such as NOW, TODAY, DATE, WEEKDAY, etc. In this tutorial, we are going to take this functionality a step further to conditionally format Excel dates in the way you want.

Excel conditional formatting for dates (built-in rules)

Microsoft Excel provides 10 options to format selected cells based on the current date.

  1. To apply the formatting, you simply go to the Home tab > Conditional Formatting > Highlight Cell Rules and select A Date Occurring.
    Excel conditional formatting built-in rules for dates
  2. Select one of the date options from the drop-down list in the left-hand part of the window, ranging from last month to next month.
  3. Finally, choose one of the pre-defined formats or set up your custom format by choosing different options on the Font, Border and Fill tabs. If the Excel standard palette does not suffice, you can always click the More colors… button.
    Choose one of the pre-defined formats or set up your custom format.
  4. Click OK and enjoy the result! : )
    Highlight cells in Excel with dates occurring in the last 7 days.

However, this fast and straightforward way has two significant limitations - 1) it works for selected cells only and 2) the conditional format is always applied based on the current date.

Excel conditional formatting formulas for dates

If you want to highlight cells or entire rows based on a date in another cell, or create rules for greater time intervals (i.e. more than a month from the current date), you will have to create your own conditional formatting rule based on a formula. Below you will find a few examples of my favorite Excel conditional formats for dates.

How to highlight weekends in Excel

Regrettably, Microsoft Excel does not have a built-in calendar similar to Outlook's. Well, let's see how you can create your own automated calendar with quite little effort.

When designing your Excel calendar, you can use the =DATE(year,month,date) function to display the days of the week. Simply enter the year and the month's number somewhere in your spreadsheet and reference those cells in the formula. Of course, you could type the numbers directly in the formula, but this is not a very efficient approach because you would have to adjust the formula for each month.

The screenshot below demonstrates the DATE function in action. I used the formula =DATE($B$2,$B$1,B$4) which is copied across row 5.
Use Excel DATE function to display the days of the week.

Tip. If you want to display only the days of the week like you see in the image above, select the cells with the formula (row 5 in our case), right-click and choose Format Cells…> Number > Custom. From the drop-down list under Type, select either dddd or ddd to show full day names or abbreviated names, respectively.

Your Excel calendar is almost done, and you only need to change the color of weekends. Naturally, you are not going to color the cells manually. We'll have Excel format the weekends automatically by creating a conditional formatting rule based on the WEEKDAY formula.

  1. You start by selecting your Excel calendar where you want to shade the weekends. In our case, it is the range $B$4:$AE$10. Be sure to start the selection with the 1st date column - Colum B in this example.
  2. On the Home tab, click Conditional Formatting menu > New Rule.
  3. Create a new conditional formatting rule based on a formula as explained in the above linked guide.
  4. In the "Format values where this formula is true" box, enter the following WEEKDAY formula that will determine which cells are Saturdays and Sundays: =WEEKDAY(B$5,2)>5
  5. Click the Format… button and set up your custom format by switching between the Font, Border and Fill tabs and playing with different formatting options. When done, click the OK button to preview the rule.
    Excel conditional formatting rule with the WEEKDAY formula to highlight weekends.

Now, let me briefly explain the WEEKDAY(serial_number,[return_type]) formula so that you can quickly adjust it for your own spreadsheets.

  • The serial_number parameter represents the date you are trying to find. You enter a reference to your first cell with a date, B$5 in our case.
  • The [return_type] parameter determines the week type (square brackets imply it is optional). You enter 2 as the return type for a week starting from Monday (1) through Sunday (7). You can find the full list of available return types here.
  • Finally, you write >5 to highlight only Saturdays (6) and Sundays (7).

The screenshot below demonstrates the result in Excel 2013 - the weekends are highlighted in the reddish colour.
The weekends are highlighted in the reddish colour.

Tips:

  • If you have non-standard weekends in your company, e.g. Fridays and Saturdays, then you would need to tweak the formula so that it starts counting from Sunday (1) and highlight days 6 (Friday) and 7 (Saturday) - WEEKDAY(B$5,1)>5.
  • If you are creating a horizontal (landscape) calendar, use a relative column (without $) and absolute row (with $) in a cell reference because you should lock the reference of the row - in the above example it is row 5, so we entered B$5. But if you are designing a calendar in vertical orientation, you should do the opposite, i.e. use an absolute column and relative row, e.g. $B5 as you can see in the screenshot below:

Excel conditional formatting formula to highlight weekends in a vertical orientation calendar.

How to highlight holidays in Excel

To improve your Excel calendar further, you can shade public holidays as well. To do that, you will need to list the holidays you want to highlight in the same or some other spreadsheet.

For example, I've added the following holidays in column A ($A$14:$A$17). Of course, not all of them are real public holidays, but they will do for demonstration purposes : )
Add list of public holidays to a worksheet.

Again, you open Conditional Formatting > New Rule. In the case of holidays, you are going to use either MATCH or COUNTIF function:

  • =COUNTIF($A$14:$A$17,B$5)>0
  • =MATCH(B$5,$A$14:$A$17,0)

Note. If you have chosen a different color for holidays, you need to move the public holiday rule to the top of the rules list via Conditional Formatting > Manage Rules…

The following image shows the result in Excel 2013:
Conditional formatting formula to highlight holidays in Excel.

Conditionally format a cell when a value is changed to a date

It's not a big problem to conditionally format a cell when a date is added to that cell or any other cell in the same row as long as no other value type is allowed. In this case, you could simply use a formula to highlight non-blanks, as described in Excel conditional formulas for blanks and non-blanks. But what if those cells already have some values, e.g. text, and you want to change the background color when text is changed to a date?

The task may sound a bit intricate, but the solution is very simple.

  1. First off, you need to determine the format code of your date. Here are just a few examples:
    • D1: dd-mmm-yy or d-mmm-yy
    • D2: dd-mmm or d-mmm
    • D3: mmm-yy
    • D4: mm/dd/yy or m/d/yy or m/d/yy h:mm

    You can find the complete list of date codes in this article.

  2. Select a column where you want to change the color of cells or the entire table in case you want to highlight rows.
  3. And now create a conditional formatting rule using a formula similar to this one: =CELL("format",$A2)="D1". In the formula, A is the column with dates and D1 is the date format.

    If your table contains dates in 2 or more formats, then use the OR operator, e.g. =OR(cell("format", $A2)="D1", cell("format",$A2)="D2", cell("format", $A2)="D3")

    The screenshot below demonstrates the result of such conditional formatting rule for dates.
    A row is highlighted when text in column C is changed to a date.

How to highlight rows based on a certain date in a certain column

Suppose, you have a large Excel spreadsheet that contains two date columns (B and C). You want to highlight every row that has a certain date, say 13-May-14, in column C.

To apply Excel conditional formatting to a certain date, you need to find its numerical value first. As you probably know, Microsoft Excel stores dates as sequential serial numbers, starting from January 1, 1900. So, 1-Jan-1900 is stored as 1, 2-Jan-1900 is stored as 2… and 13-May-14 as 41772.

To find the date's number, right-click the cell, select Format Cells > Number and choose the General format. Write down the number you see and click Cancel because you do not really want to change the date's format.
Find the numerical value of a date.

That was actually the major part of the work and now you only need to create a conditional formatting rule for the entire table with this very simple formula: =$C2=41772. The formula implies that your table has headers and row 2 is your first row with data.

An alternative way is to use the DATEVALUE formula that converts the date to the number format is which it is stored, e.g. =$C2=DATEVALUE("5/13/2014")

Whichever formula you use, it will have the same effect:
Highlight every row based on a certain date in a certain column.

Conditionally format dates in Excel based on the current date

As you probably know Microsoft Excel provides the TODAY() functions for various calculations based on the current date. Here are just a few examples of how you can use it to conditionally format dates in Excel.

Example 1. Highlight dates equal to, greater than or less than today

To conditionally format cells or entire rows based on today's date, you use the TODAY function as follows:

Equal to today: =$B2=TODAY()

Greater than today: =$B2>TODAY()

Less than today: =$B2<TODAY()

The screenshot below demonstrates the above rules in action. Please note, at the moment of writing TODAY was 12-Jun-2014.
Excel formulas to highlight dates equal to, greater than or less than the current date.

Example 2. Conditionally format dates in Excel based on several conditions

In a similar fashion, you can use the TODAY function in combination with other Excel functions to handle more complex scenarios. For example, you may want your Excel conditional formatting date formula to color the Invoice column when the Delivery Date is equal to or greater than today BUT you want the formatting to disappear when you enter the invoice number.

For this task, you would need an additional column with the following formula (where E is your Delivery column and F the Invoice column):

=IF(E2>=TODAY(),IF(F2="", 1, 0), 0)

If the delivery date is greater than or equal to the current date and there is no number in the Invoice column, the formula returns 1, otherwise it's 0.

After that you create a simple conditional formatting rule for the Invoice column with the formula =$G2=1 where G is your additional column. Of course, you will be able to hide this column later.
Excel conditional formatting rule to highlight blank cells in the Invoice column when the Delivery Date is equal to or greater than today.

Example 3. Highlight upcoming dates and delays

Suppose you have a project schedule in Excel that lists tasks, their start dates and durations. What you want is to have the end date for each task calculated automatically. An additional challenge is that the formula should also consider the weekends. For example, if the starting date is 13-Jun-2014 and the number of days of work (Duration) is 2, the ending date should come as 17-Jun-2014, because 14-Jun and 15-Jun are Saturday and Sunday.

To do this, we will use the WORKDAY.INTL(start_date,days,[weekend],[holidays]) function, more precisely =WORKDAY.INTL(B2,C2,1).
The WORKDAY.INTL formula calculates the End Date for each task taking into account the weekends.

In the formula, we enter 1 as the 3rd parameter since it indicates Saturday and Sunday as holidays. You can use another value if your weekends are different, say, Fri and Sat. The full list of the weekend values is available here. Optionally, you can also use the 4th parameter [holidays], which is a set of dates (range of cells) that should be excluded from the working day calendar.

And finally, you may want to highlight rows depending on how far away the deadline is. For example, the conditional formatting rules based on the following 2 formulas highlight upcoming and recent end dates, respectively:

  • =AND($D2-TODAY()>=0,$D2-TODAY()<=7) - highlight all rows where the End Date (column D) is within the next 7 days. This formula is really handy when it comes to tracking upcoming expiration dates or payments.
  • =AND(TODAY()-$D2>=0,TODAY()-$D2<=7) - highlight all rows where the End Date (column D) is within the last 7 days. You can use this formula to track the latest overdue payments and other delays.

Excel conditional formatting rules to highlight upcoming dates and delays

Here are a few more formula examples that can be applied to the table above:

=$D2<TODAY() - highlights all passed dates (i.e. dates less than the current date). Can be used to format expired subscriptions, overdue payments etc.

=$D2>TODAY() - highlights all future dates (i.e. dates greater than the current date). You can use it to highlight upcoming events.

Of course, there can be infinite variations of the above formulas, depending on your particular task. For instance:

=$D2-TODAY()>=6 - highlights dates that occur in 6 or more days.

=$D2=TODAY()-14 - highlights dates occurring exactly 2 weeks ago.

How to highlight dates within a date range

If you have a long list of dates in your worksheet, you may also want to highlight the cells or rows that fall within a certain date range, i.e. highlight all dates that are between two given dates.

You can fulfil this task using the TODAY() function again. You will just have to construct a little bit more elaborate formulas as demonstrated in the examples below.

Formulas to highlight past dates

  • More than 30 days ago: =TODAY()-$A2>30
  • From 30 to 15 days ago, inclusive: =AND(TODAY()-$A2>=15, TODAY()-$A2<=30)
  • Less than 15 days ago: =AND(TODAY()-$A2>=1, TODAY()-$A2<15)

The current date and any future dates are not colored.
Formulas to highlight past dates in a certain date range

Formulas to highlight future dates

  • Will occur in more than 30 days from now: =$A2-TODAY()>30
  • In 30 to 15 days, inclusive: =AND($A2-TODAY()>=15, $A2-TODAY()<=30)
  • In less than 15 days: =AND($A2-TODAY()>=1, $A2-TODAY()<15)

The current date and any past dates are not colored.
Formulas to highlight future dates in a given date range

How to shade gaps and time intervals

In this last example, we are going to utilize yet another Excel date function - DATEDIF(start_date, end_date, interval). This function calculates the difference between two dates based on the specified interval. It differs from all other functions we've discussed in this tutorial in the way that it lets you ignore months or years and calculate the difference only between days or months, whichever you choose.

Don't see how this could work for you? Think about it in another way… Suppose you have a list of birthdays of your family members and friends. Would you like to know how many days there are until their next birthday? Moreover, how many days exactly are left until your wedding anniversary and other events you wouldn't want to miss? Easily!

The formula you need is this (where A is your Date column):

=DATEDIF(TODAY(), DATE((YEAR(TODAY())+1), MONTH($A2), DAY($A2)), "yd")

The "yd" interval type at the end of the formula is used to ignore years and calculate the difference between the days only. For the full list of available interval types, look here.

Tip. If you happen to forget or misplace that complex formula, you can use this simple one instead: =365-DATEDIF($A2,TODAY(),"yd"). It produces exactly the same results, just remember to replace 365 with 366 in leap years : )

And now let's create an Excel conditional formatting rule to shade different gaps in different colors. In this case, it makes more sense to utilize Excel Color Scales rather than create a separate rule for each period.

The screenshot below demonstrates the result in Excel - a gradient 3-color scale with tints from green to red through yellow.
The 3-color scale shades cells in different colors based on how many days are left until the event.

"Days Until Next Birthday" Excel Web App

We have created this Excel Web App to show you the above formula in action. Just enter your events in 1st column and change the corresponding dates in the 2nd column to experiment with the result.

If you are curious to know how to create such interactive Excel spreadsheets, check out this article on how to make web-based Excel spreadsheets.

Hopefully, at least one of the Excel conditional formats for dates discussed in this article has proven useful to you. If you are looking for a solution to some different task, you are most welcome to post a comment. Thank you for reading!

1208 comments

  1. TaskAID Associate Start Time Start Time (Mins) End Time (Mins) Duration (secs)
    ab1 1 def1 4/20/22 6:30 6:30:00 AM 6:30:16 AM 16
    ab2 2 def2 4/20/22 6:30 6:30:00 AM 6:30:16.5 AM 16.5
    ab3 3 def3 4/20/22 6:30 6:30:00 AM 6:30:16.2 AM 16.2
    ab4 4 def4 4/20/22 6:30 6:30:00 AM 6:30:18 AM 18
    ab5 5 def5 4/20/22 6:30 6:30 AM 6:30 AM 19
    ab6 6 def6 4/20/22 6:30 6:30 AM 6:30 AM 22
    ab7 7 def7 4/20/22 6:30 6:30 AM 6:30 AM 19.5
    ab8 8 def8 4/20/22 6:30 6:30 AM 6:30 AM 18.7
    ab9 9 def9 4/20/22 6:30 6:30 AM 6:30 AM 15.4
    ab10 10 def10 4/20/22 6:30 6:30 AM 6:30 AM 15.9

    Want to create a stacked bar chart (gantt chart) kind of chart with start time on the x-axis and a line or block starting at time t (start time) and extends till the start time + duration and a gap of time t1 (start time of next task - stop time of previous job by the same individual
    need to plot the same row for multiple individuals who performed multiple tasks

  2. I've been using a 12 month calendar on one of my worksheets in my document. The dates used to "gray" out as the date passed, but for some reason it no longer does this. I didn't create the document and the person who did no longer works here. I don't see any conditional formatting in the worksheet, so I'm not sure how to fix it. Any help would be greatly appreciated.

    • Hi!
      Pay attention to the following paragraph of the article above: Conditionally format dates in Excel based on the current date. Use these recommendations and set the desired color for dates less than the current one.

  3. Hi - I was hoping someone could help.

    I am trying to highlight rows based on months. So... if there was a date between 6/1/22 and 6/30/22, I need it to be a certain color, etc. Different colors for each month. I've read through conditional formatting and do not see how I add a date range.

    Thanks for your help!

  4. Greetings smart people!

    I've tried applying the information gleaned from this article, but I'm having some difficulties.

    I have a "graphics board" that I enter data into daily, wherein outstanding graphic requests are listed containing the Order Date, Due Date, the Approval Date for a given order, and other information.

    What I'm trying to do, is to highlight any rows where the Approval Date (Column G) is equal to or less than 2 days from the Due Date (Column H), not including weekends.

    As a bonus note, I'd ALSO like to automate additional formatting for the "Order Date" field (Column D), where affected rows are further modified if the values are equal to or less than 3 days from the Due Date (again, not counting weekends.) If I can fix the formula for the Approval vs. Due Date argument, I'm sure I could duplicate it for the other two columns.

    Grateful for any help you folks can provide!

    Thank you,

    Miranda

  5. Hello! If I needed to highlight any cell on my worksheet that contained any date, how would I do that?

  6. I have read and looked at this thread and by far it is very detailed and more comprehensive than any other resource out there.
    I have been trying to build conditional formatting formula for a sequence of logical arguments working with 2 columns that have different dates. My table is a blank table that needs filling in.
    I need conditional formatting to highlight the entire row based on logical arguments based on the 2 dates from 2 columns, for instance if one date is earlier than today and the second date from column is an empty cell, to be yellow and the rest of the table not to be formatted. I sort of figured out 2 arguments with and formula and dates on the other column, but I need if possible to create if that particular cell is blank.
    If not how could I link the argument to an additional column that has text as yes it no.
    In conclusion I will need 4 formulas and not sure which one is taking priority and hie to have 4 colours on my table.
    Thank you very much!
    Best regards
    Nico

  7. I'm working on trying to conditionally format 1 column using a 3 color scale based off the dates within those cells. These are all shipping deadlines in, lets call it column C, which is linked to other columns based off of inbound ETA's. The minimum value would be 3 days or less to the date within said cell, midpoint would be 7 to 4 days within said cell and the maximum would be anything greater than 8 days. I've read this post a few times and can't exactly find a situation that I can model a formula off of but more than likely I'm so confused I just don't see or get it. The today function wouldn't work for this because the current date isn't a factor - the cells in question I've just added a formula to tack on 15 days from another date in a separate column which is doing a lookup in a different sheet. Point is the dates are constantly changing so not sure how to set up the formula / what technique to use to format.

    • Hello!
      Create three conditional formatting rules for your conditions separately for each color. All examples are in this article. Instead of the TODAY function, use a reference to your cell with the date. I hope it helps.

  8. So I have a large excel sheet full of training dates expiry's
    I am trying to have it so 3 months before the training expiry the cell goes orange and on the day and after goes and stays red and green if the training is otherwise ?
    could you help please i really really need this would make my life so much handier for work

    • Hi!
      I hope you have studied the recommendations in the tutorial above. Pay attention to the following paragraph – How to highlight dates within a date range. There is an answer to your question. Create a separate conditional formatting rule for each condition.

  9. Good afternoon sir, the situation is like this, on the top it's categorized as per month from January to December, and I have a date and due date on the left side, by subtracting the date and due date, how can I make the difference of date and due date appear on the exact month with conditional formatting?

    • Hi!
      Have you tried the ways described in this blog post? If they don’t work for you, then please describe your task in detail, I’ll try to suggest a solution.

      • Good morning sir from the Philippines.

        Yes sir, the formulas are working but it will take time for me to do that, because I have a series of dates and due dates on the left side, if I drag it all down it will be okay for that certain month, but if I drag the formula to the right since the months starts with January the formula will not work, for the formula is just for January only.

        My worksheet on the left side column A the name of the product, B and C are the dates and due dates respectively, for Columns D onwards are the months starting January to December. What I wanted to do for example, the due date is on January 7 and the date will be January 9 so the difference will be 2 days, making the formula it will pop 2 days under the month of January, but for the other list with other months doesn't fall for the right month with their difference in days.
        That's my problem sir, the differences made from other products list doesn't fall for the right months as the products list with their due dates.

        Thank you for the help in advance.

        Your help is always appreciated...

        • Hello!
          I’m not sure I got you right since the description you provided is not entirely clear. However, it seems to me that the formula below will work for you:

          =IF(MONTH($C2)=COLUMN()-3,$C2-$B2,"")

          Write this formula in D2 and copy it to the right along the row. The MONTH function will determine the desired month.

          • Good morning sir, what I meant to that statement was, the difference of the given date and due date should fall under the months given. For example,
            Due date is January 7, date finished is January 9 their difference is 2 days right, so the 2 days difference should fall under the Month of January.
            But if the next product's due date is February 9, and it finished February 12 their difference would be 3 days and should fall under the month of February.
            The difference of the series of products have different Due Dates that should fall under its respective months.
            My point sir is when I drag the formula down and from left to right, it doesn't go that way, the difference of the day doesn't fall on the exact month. If the due date's on January the difference should fall on January but if it's on April the difference of the day should fall on April too, from the column D - Column O (January to December)

            I will try the method you have given.

            Thank you for the support and it's always appreciated.

  10. Hi, I am trying to highlight dates that are a week from due and then others that are past due. When creating those rules it asks to highlight the cells. Some of the cells are not currently in use but could be added to later, is there a way to only highlight the ones that are in use and the blank cells are white until there is a date entered?

    • Hello!
      Add a condition to the conditional formatting formula that the cell must not be empty. For instance,

      =AND(B1-A1<7,B1<>"")

  11. Help with filling of todays Date. If I fill something in column B todays date must fill automatic in column A.
    Please assist

  12. So I have a list of a bunch of different Dates and i need them to turn green after 7 days have passed from that date. Ex: the original date is 1/12/22 so the box should turn green on 1/19/22 what would be the formula for this ?

  13. I have a training spreadsheet that I need to have recognize training expiring next month, this month, and expired either in previous month or months. I know can do dates occurring for this month and next month but need more then one month back. I can't remember the formula to highlight something over 30 days past.

  14. hi,
    i'm new to excel, i'm trying to figure something out. i have a list of people who need to do recurrency training every 3 years. i have the date they did las training and used a formula to automatically fill in +3 years. what i want to find out how to do is, i want the cells to be green if their training is current, yellow 6 months before training is due and red if the date has passed. can you help me with this please?

  15. Hello, i just have a question:

    I'm building a vacation planner and I would like to highlight all days between start date and end date which are going to be inserted in another excel sheet.

    In the main sheet there's the table with all days of the month/year, in another sheet there's all information about permissions and related date.

    How would you manage that using conditional formatting?

    Thanks in advance

    • Hello!
      I hope you have studied the recommendations in the tutorial above. It contains answers to your question. Pay attention to the following paragraph of the article above - How to highlight dates within a date range.

  16. I have a row with a cell dedicated for each day of the month. I'd like to average the sums in the cells based on the current date. The average should include the amounts of all cells from days in the past (including empty ones) and exclude the cells with dates in the future.
    As an example: Let's say that it's the 4th day of the month and two cells contain 10 and two cells are empty. We know the average is 5 but using =IFERROR(AVERAGE(B5:AF5),0) forces me to input a "0" in cells dated in the past.

      • Today is the 5th day of the month. Day 3 of the month (cell D5) contains 126.53.
        Following your lead I tried using =AVERAGEIF(B5:AF5, "<="&TODAY(), B5:AF5)
        That formula returns 126.53 because there is nothing else to average unless I input "0"s into cells B5, C5, E5, and F5.
        How can I tell Excel to output the average 126.53 based on the day of the month (without using zeros on the days gone past)?

          • =AVERAGEIFS(B5:AF5,B4:AF4,""">=12/31/2021",B4:AF4,"<="&TODAY()) shows some promise but results 126.53 for an average of 5 days when it should result 25.31. (If I use zeros in the other 4 cells the correct average results.)

            • Correction to above:
              =AVERAGEIFS(B5:AF5,B4:AF4,""">=12/31/2021",B4:AF4,"<="&TODAY())

            • Hi!
              To take into account empty cells in the AVERAGEIFS formula when calculating the average, try the formula

              =SUMIFS(B5:AF5,B4:AF4,"> ="&DATEVALUE("12/31/2021"),B4:AF4,"< ="&TODAY())/COUNTIFS(B4:AF4,"> ="&DATEVALUE("12/31/2021"),B4:AF4,"< ="&TODAY())

              I hope it’ll be helpful.

  17. I have a spreadsheet to track assignments. Column G contains the dates the work was assigned. Column I contains the dates when each assignment was completed. If it was completed more than 30 days from the date assigned, I would like that cell to highlight yellow. What formula would I use for this?

    For example:
    G2 shows that an assignment was made on 07/20/2021
    I2 shows that the assignment was completed on 09/13/2021

    I would like cell I2 to highlight letting me know the work was completed more than 30 days from the assigned date.

    Thank you for any guidance you're able to provide.

  18. i have a spreadsheet with a list of employee's and their different types of training. i have used conditional formatting to highlight the cell in yellow when the expiration date is 30 days away and red on the expiration date. how do i get the cell to stay red then change to no background color until a new expiration date is entered ?

      • I am using a very large spreadsheet with names, dates, merged cells. I made a column selection that holds mostly date values but also names. How can I conditional format the columns that it only changes the date cells to a certain color?

        I am using =(beginning cell)<=TODAY()-365 but blank cells and name cells are also being modified. I want it to affect only date cells.

  19. Hi can anyone help me how to formula this
    A B C D
    - 17-Jun-20 17-Jun-20 - I need this part to be Null or Zero.
    6,000.00 28-Dec-20 29-Sep-21 29-Sep-21
    50,328.00 20-Oct-20 20-Oct-20
    - 07-Jan-21 07-Jan-21 - I need this part to be Null or Zero.
    336.00 22-Mar-20 04-Oct-21 04-Oct-21
    - 22-Mar-20 04-Oct-21 04-Oct-21 - I need this part to be Null or Zero.

    in the 1st column A1 is blank then D1 should be blank as well
    I used the formula for B & C
    =MAX(IF('LPO & INVOICE (2020)'!$C$6:$C$548='LEDGER LPO & INVOICE (MIX) (2)'!C197,IF('LPO & INVOICE (2020)'!$D$6:$D$548='LEDGER LPO & INVOICE (MIX) (2)'!$G$5,'LPO & INVOICE (2020)'!$K$6:$K$548)))

    to locate the latest dates on each sheets.

    • Hi!
      It is very difficult to understand a formula that contains unique references to your workbook worksheets.
      What does the “17-Jun-20 17-Jun-20 – I need this part to be Null or Zero.” phrase mean? Your explanations are not clear.

  20. Hi! Looking to create a sheet where I can highlight based on a time frame. I need time windows every 2 hours starting at 8:30AM and ending at 4:30PM to be in one color but 4 different shades going from lighter earlier in the day to darker later in the day(Ex 8:30AM-10:30AM would be light blue, 10:30AM-12:30PM would be a darker blue and so forth). and with that same formula have it switch colors based off the name input. (Ex Mark would be blue - in four different shades. and Joe would be red - in four different shades. and Aaron would be green, etc.) That would be for a calendar month and able to put multiple on a single day. (Ex Mark has a job at 8:45AM and 2:30PM - that would be the lightest blue and darkest blue. but then joe has a job at 8:45AM, 11:00AM, and 2:30PM as well as Aaron has a job at 9:00AM and 1:00PM). How in the heck would I even do this???

  21. Thank you for this amazing support and guidance
    I am trying to use a yearly date range. For example, I have employees who have completed First Aid Courses and I need a reminder as when the qualification will expire onto a training matrix
    Would this be possible. (I have over 200 employees so impossible in Calendar.
    Thank you in advance

    • Hello!
      If the validity period expires, for example, after a year, then the conditional formatting formula can be applied to the cells in which the date of completion of the courses is written:

      =D2+365>TODAY()

  22. I have a question. I have a certification grid using values linked to another spreadsheet. I have those linked correctly, but what I now want to do is create a conditional format for the date value in the cell +650 days (because it is a certification of every 2 years). This will tell us when they are 90 days away from needing to recertify, where the cell value is the date they last certified.

    Ex. Bill certified 1/20/2020, I want to change the color of the cell so that 650 days after that date, sometime in October, the cell will turn yellow indicating they are coming due for recertification. Then another condition for red cell, when they are 30 days away (700 days after).

    Is this possible with the current rule sets in Excel?

  23. Hi, I have a gantt chart that I have a date (say 7/10/2021) in col E and the number of day (say 5) in col F. I need to have the number of days highlighted in different colours depending on the category (say painter, green highlight) in col C - with the start date on the date entered in col E. I can't seem to figure out the formula for the conditional formatting rule to achieve this. Are you able to assist?

  24. I am trying to use conditional formatting to change the colour of a cell if the time is over 4 hours, 5 hours, 9 hours for the spredsheet to correctly determine break eligibility. I've currently got the cell F4 calculating the difference in time (E4, D4), and when i go to format G4 to change colour depending on the value in F4 it wont recognise the value as it is in Time format. is there a way around this? Happy to provide screenshots.

  25. Hi there,

    I reconcile spreadsheets monthly. A report is generated the 3rd friday of every month.
    17-Sept-21 is the last date of the report. It is in cell D3. This number will get updated every month.

    Now I have 30 spreadsheets to reconcile. I don't always get to them every month.

    I want to used conditional formatting. I really would like the Icon set to appear in the Cell D beside the last reconciled date in that cell for that spreadsheet number.

    green check if is is within 30 days
    yellow ! if is is 60
    red X if it is 90.

    I had it on friday then my spreadsheet crashed and didn't auto save and I can not figure it out again.

  26. Hi

    Thank you so much your all your conditional formatting articles helped me a lot. I didn’t find an answer to only this question:
    I have a teacher working in two branches can we combine two conditional formatting rules (duplicate n between) or any other formula to prevent me giving the same time slot or in between times to same teacher in a different branch

    Ex br 1 Mr.X. 13-17

    br 2. Mr.X. 13-17 or in between times likes 15-16 ( a colour to indicate the mistake) since during that time he’s already working.

    Thank you

  27. Hi Alex,

    I hope you can help me with the following issue:
    In my school, I have created a form in which teachers can use to fill out when a student has detention. Teachers have the ability to click on the first column to select a date, put the student’s name on the next column, and so on.
    In the past, I’ve made it so that if a certain number of students are put on the list for a given day, the row turns red. Our detention room only has 12 seats, so I didn’t want teachers assigning more than 12 students each day. So, when a teacher selects the same date on a 13th row, the whole row would turn red, which they would automatically know that the detention room is full and same that entry for the next day.
    The problem I’m having is that I forgot how to create this again. Someone messed with my settings and I can’t remember how to duplicate this again.
    How can I get this done??
    Thank you!!

    Victor

    • Hello!
      This formula for the rule of conditional formatting highlights the color of all values, the number of which in the column is greater than 12.

      =COUNTIF($A$2:$A$1000,A2)>12

      I hope my advice will help you solve your task.

  28. Hello!
    Thank you for sharing...great article!

    How do you use conditional formatting in identifying date and time conflicts? Date in one column and time (24:00 format) in another column?

    Thank you!

  29. Hi,
    How do I put conditional formula for time.
    Eg : if the Time is 10:09:33
    then I want to put conditional formula as if time is before 10am or after 10 am..
    Please help

  30. Excellent blog!!! It was very helpful and was able to solve few of the problems using the techniques listed here. Thanks a ton and keep sharing your knowledge.

  31. I've tried running the "How to highlight dates within a date range" formatting but I'm finding that the last date in the range is coming up in the wrong colour. So for instance I want under 10 days listed red, 11-15 in orange and anything over 15 days green, however I'm finding that the formula works except for the last one in the list. For example I'll have 5 27.08.2021 then 4 31.08.2021. The first four of the 27.08.2021 change to the right colour but the 5th one is getting assigned the colour of the 31.08.2021. Hope that makes sense!
    Any suggestions as to what I am doing wrong?

  32. Thank you Alexander for ALL of your help! I do have one more question. If I used the "today" format, and I want it to calculate 1 year AND 1 month from then, would I use 395 instead of 365 at the end of my formula?

  33. I’m building a gantt chart and I’m trying to add an icon in conditional formatting to represent my milestones but I have not had any luck is there a formula that I could use to get it to work??

  34. Morning,

    I am trying to create a project management calendar. We have start and end dates for certain tasks (8/16/21 start date and 9/17/ 21 end date). Task description is listed in column A, start date in Columb B, and then end date in column C (all listed in row 3 and under, depending on the amount of task). In D-AA we have a "Calendar" set within row 2, of every Monday for the next year.

    The goal is to conditionally format the cells in column D-AA and under row 2 (so row 3 and under) to highlight a color (i.e red) during the date range. So every task will have a different start and end date aka the colors will change in every cell between D-AA

    • Hello!
      Have you tried the ways described in this blog post? If they don’t work for you, then please describe your task in detail, I’ll try to suggest a solution.

  35. Hello,
    I need to highlight cells based on a date within the cell NOT todays date. I want a cell to highlight based on 30 days from the day in the cells within a column.

    Example: I want to have each manager over their department know when their employees annual renewals are due. I would like it to be based on JUST the month and the day NOT the YEAR since that year is listed by their original hire date. My plan is to take the year out listing only the month and day so that if it is 30 days past that date it will turn red

    • Hello!
      Use the formulas from the paragraph - How to highlight dates within a date range.
      Use the date cell address instead of the TODAY function.
      If this is not what you wanted, please describe the problem in more detail.

      • Alexander,
        Thank you for responding. This is not what I need as I explained previously, I am looking for dates that are 30 days away from the date that is in a cell. That is why I explained that I cannot use the "today" function. I do not have 2 dates listed so I cannot use a "date range" function, I don't believe.

        Example:
        Column A Employee #
        Column B Employee Name
        Column C Years Employed
        Column D Date of Hire MONTH AND DAY ONLY
        Column E Job Code

        I am looking for Column D to change a color when it is 30 days past the date entered in that column.
        Also I want the format to look and ONLY a MONTH and a DAY I do not want the year to be part of this as I believe it will not work since our employees tenure ranges from 1 year to 40+.
        I am VERY green when it comes to Excel so could you give as much detail as possible? Please and thank you!

        • Hi!
          How do you want to define 30 days if you only have a month and a year? If the date is only a month and a day, then it is written not as a date, but as text.

          • So, there has to be a year attached?
            If so, I will use the current year but, I want the 30 days to be 30 days PAST the day that is in each cell located in Column D.

            For instance if D says 8/21/21Then by 9/14/21 I would like that cell to be red

            • Hello!
              If the date is written in column D, then you can use the recommendations from this article above. In the formatting condition, instead of the TODAY function, use a cell with a date

              =F1-D1>30

              I hope my advice will help you solve your task.

              • Alexander,
                I'm sorry but, would you give me step by step instructions on how to insert this formula? As I explained, I am very green with spreadsheets. What is f1? Is that assuming I am using another column? Also, is this a conditional formatting formula? Does it go in a specific box?

              • Hi!
                In the formula

                =$F$1-D1>30

                F1- the date from which you will compare all cells in column D.
                How to create and use a conditional formatting formula is detailed in this article above.

  36. Hi,

    I would like to simply highlight any cell with a date of today or older - older than a month too

  37. Looking to highlight months 1, 2 and 3 months out, so ex I would like a cell to highlight red if its says JUL and it is currently JUL and highlight Yellow If the cell says JUL and it is JUN, so highlighting cur month as well as the 2 months prior to end of current month, the formula set up now is broken and I can not figure it out

    =MONTH(EOMONTH(TODAY(),3))
    =MONTH(EOMONTH(TODAY(),2))
    =MONTH(EOMONTH(TODAY(),1))

    I am getting 0 highlights and I am unable to get it working

    • Hello!
      If I understand your task correctly, the following conditional formatting formula should work for you:

      =MONTH(A2) <= MONTH(EOMONTH(TODAY(),1))

      I hope it’ll be helpful.

  38. Hi I'm trying to show a RAG to a cell if a date scheduled was achieved or not. I understand how to add a conditional format however I have to make a new rule for each cell in the column. For example in column A the dates are different in each row in column B a formula is used to show the date due and then in column c the actual date completed is inserted. I would like to highlight if this matches the due date using RAG and can only achieve this if I add a new rule to each cell in each row in column C. I'm looking for a way to copy the rule into each of the cells that will auto generate column C to look across the row at cells, c1 to look at b1, c2 to look at b2 and so on.. pls help!

  39. Hi,

    I have two columns. One contains starting date and another contains exact 6 months from that starting date(Note: few dates are in the past). Now I want to highlight the dates which are greater than today. How to do that?

  40. Hi. Thanks for these examples. I am trying to highlight a cell based on two criteria:
    1. If the date is within 15 days of today
    2. If the cell in another text is "TBD"

    This is what I have but it isn't working:
    =IF(W2=TODAY()<15,IF(K2="TBD",1,0),0)

    Am I missing something or do I have something written incorrectly?

    Thank you

    • Actually, I think I figured it out:

      =IF(W2-TODAY()<15,IF(K2="TBD",1,0),0)

      I just changed the "=" to "-".

      Thanks

  41. hi is there a way to create a formula to automatically highlight cells when the figures in a certain cells are unchanged after lets say 6 months. for instance if you keep records manually of 20 bank customer's balances and you want the cells of inactive customers (for 6months) with an unchanged balance to change colour automatically. How can this be achieved?

    • Hello!
      If your table contains data, for example, at the beginning of each month, then it is very easy to determine that 6 digits are the same.

  42. I have used the conditional format cells based off of date using colors Red for overdue dates, Yellow for coming due in 30 days and Green for current. Now that I have all that, Column A is a list of names. I am wanting to know if there is a conditional formula to change the name color to green is all cells in their row are green, yellow if there is yellow cells in their row and red if there are red cells in their row. Is there a way to do this? Thanks for your time.

  43. H, Trying to set up a conditional format for a column of dates, (expiry dates that may need updating). I wish to highlight all dates prior to todays date. ie. each day if there is a date 'out of date' it will turn red.

    Thought I had set it up to do this as above instructions however it is changing other dates to red also?

    Advice appreciated.

  44. Hello,

    I want to color only fridays..

    • =(WEEKDAY($A8,15)>1)-1

  45. Hello, I am trying to change the color of a cell when it is coming due, overdue and then when it is current. The date is coming due (orange) the first of every month. The date becomes overdue (red) when it is the 16th of each month if not completed. The date, or cell, is current again (green) once it's completed the first of the next month. Not every cell will be overdue of course, only if a current date is not entered by the 15th of each month. Any help would be greatly appreciated!

    • Hi!
      I hope you have studied the recommendations in the tutorial above. It contains answers to your question. For each condition, write down a separate formatting rule as described in the article above.
      I recommend reading this guide: Apply several rules to one cell.
      I hope it’ll be helpful.

  46. Hello,
    I am trying to figure out if this date (column P) is within one year of that date (column C):

    Renew date: 7/31/21
    RX date: 5/31/21

    is the RX date within 365 days of the renew date? If not within one year, can it be highlighted in red so I know to stop. I cannot us an RX that is move than one year old (I cannot use an RX from 7/29/20 form example)
    is this possible ?

  47. Hello,

    I am trying to highlight rows where the Implementation Date in Excel column P is past 7/31/2021. I used the formula '=$P2>=DATE(2021,7,31)'. I also converted the Date to its numerical value in a column at the end of the spreadsheet. Conditional Formatting in both cases highlights incorrect rows (before 7/31) and skips rows that meet this specific criteria. Both ways highlights the same, incorrect rows. Do you know why that happens? Please advise...

    • Hello!
      Unfortunately, without seeing your data it is difficult to give you any advice. If your date is written as text, then the formula will always return TRUE. Check this.

  48. Hiya! I am a teacher trying to organize whether a student is under the age of 9 years as of "TODAY" so that I can use the checkbox TRUE or FALSE as they'll need testing or not. For example, if Student A is under the age of 9 years old (even by a day) as of today, then checkbox is TRUE. (They will need testing). How can I writ eout this formula prettyt please?

  49. in an excel cell, I set the expired date is 4/30/2022. when the date 4/30/2022 comes, I want the in warranty credit value of another cell to set to zero permanently. What formula could I use? please help?

    • Hi!
      In this cell, you can use the formula with the IF function with date. Read this article.
      If you need to change the content on the cell that has some value in it, you’ll need to use a VBA macro.

  50. Hello,

    Hi, I'm trying build a recurring maintenance schedule for list of equipment per recommended maintenance matrix within 12 months. maintenance frequency are every 2 months, every 6 months, every 12 months. I would like a conditional formatting formula to color code cells per predefined maintenance duration in days per maintenance frequency stated above within a 12 months period. So far I have column in days that span over 12 months, rows - predefined maintenance duration/maintenance frequency/equipment and task Start and Finish dates per equipment. thanks for your help in advance

    • Ablebits.com Team - Any luck with my help request?

      • Hi!
        According to your description it is difficult for me to understand your data.
        To add 2 months to a date, you can use the formula

        =DATE(YEAR(A2), MONTH(A2) + 2, DAY(A2))

        Conditional date formatting is described earlier in this article.
        Give an example of the source data and the expected result.
        It’ll help me understand it better and find a solution for you.

        • thanks for the acknowledgement. See below example as requested. I tried simplifying with just one Equipment.

          Source Data: Equipment A - Task Duration (Cell C5 - Start date Aug 2 2021, D5 -End date, Dec 31 2023), Cell E5 (Maintenance Frequency – Every 60 days), Cell F5 (maintenance duration – 4 days), Cell G5 (# of personnel to perform the maintenance – 3).

          Expected Result: Under a list of dates that span from Aug 2, 2001 to Dec 31 2023 (a cell representing a day) – Cell H4 to xx4, create a dynamic cells using conditional formatting to show recurring maintenance schedule for Equipment A – every 60 days perform a 4 days maintenance using C5 as start date, next maintenance will be (C5+F5) +60 days. Last day of each maintenance frequency should initiate the 60 days counter for the next maintenance cycle. This sequence should end at day = D5. Only maintenance duration should be color coded and number of personnel (G5) to be inserted each color coded cell.

          Thanks for you assistance in advance.

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