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 32. Total comments: 1243

  1. hi ...
    can i vary content of entire column using universal formula based on contents of another column ???

    waiting for reply

    1. yes

  2. PLEASE HELP ME IN THIS ISSUE
    01-07-2013 A1
    01-10-2013 A2
    14-12-2013 A3
    01-10-2014 A4
    17-10-2014 A5
    01-03-2015 A6

    Now I want to fill like this automatically below cells D4 and E4:
    D4 E4
    01-07-2013 31-07-2013
    01-08-2013 31-08-2013
    01-09-2013 30-09-2013
    01-10-2013 31-10-2013
    01-11-2013 30-11-2013
    01-12-2013 13-12-2013
    14-12-2013 31-12-2013
    01-01-2014 31-01-2014
    01-02-2014 28-02-2014
    01-03-2014 31-03-2014
    01-04-2014 30-04-2014
    01-05-2014 31-05-2014
    01-06-2014 30-06-2014
    01-07-2014 31-07-2014
    01-08-2014 31-08-2014
    01-09-2014 30-09-2014
    01-10-2014 16-10-2013
    17-10-2013 31-10-2013
    01-11-2014 30-11-2014
    01-12-2014 31-12-2014
    01-01-2015 31-01-2015
    01-02-2015 28-02-2015
    01-03-2015 31-03-2015

    1. HI, FRIENDS I AM SUBMITTING MY PROBLEM LIKE THIS.
      DATE PAY Rs.
      A1: 13-07-2014 15000
      A2: 17-10-2014 17000
      A3: 01-12-2014 19000

      ABOVE SERIES IS TO MAKE SALARY BILLS IN FRACTION OF A MONTH AND
      Now I want to fill like this automatically below cells D4 and E4:

      D4 CELL E4 CELL PAY Rs.
      13-07-2014 31-07-2014 15000
      01-08-2014 31-08-2014 15000
      01-09-2014 30-09-2014 15000
      01-10-2014 16-10-2014 7742 ( FOR 16 DAYS @15000 P/M)
      17-10-2014 31-10-2014 8226 ( FOR 15 DAYS @17000 P/M)
      01-11-2014 30-11-2014 17000
      01-12-2014 31-12-2014 19000

      D4 IS ALWAYS FIRST OF THE MONTH UNTIL FRACTION COMES AND E4 IS ALWAYS END OF THE

  3. I NEED HELP!!! Trying to get cells to fill different colors based on date in cell for yearly (annual)certification.
    Example....cell E3 date is 1-JAN-15,

    **no action needed (green fill)1-JAN-15 to 1-OCT-15
    **must complete training in next 90 days(yellow fill)1-OCT-15 to 31-DEC-15
    **expired(red fill) 1-JAN-16 or after

    So if they completed cert on 1 APR 14...the cell should be yellow right now bc it is due to expire in the next 90 days.
    If they completed cert on 1 FEB 14 cell should be red bc it is past 1 yr.
    If they completed cert on 1 DEC 14 cell should be green bc they have 9months before the 90day window.

    Any help is GREATLY appreciated!!!

  4. Can some on please help me with this. thanks in advance.
    some cells in Column C have dates. I want to put a conditional format formula which will highlight the same line cell number in column E if there is any date in Column C.
    for example
    C2 has a date, then E2 becomes yellow
    C3 doesn't have date, E3 remain clear
    C4 has a date, then E2 becomes yellow
    and so forth

  5. hello! so I have a column were the names of certain permits are, and another for the date it was issued and another for the date of expiry. I want to have my cells with the names turn orange when there's only 2 months before it expires and green if it is still far from expiring, red when it has already expired. Thank you!!!

    1. Hello Lyka,

      Select your column with the names and create 3 conditional formatting rules using the following formulas:

      Red:
      =AND(C2<>"",$C2

  6. I am trying to highlight the days between start date and end date for a given task. tried conditional formatting does not work.

    I tried to just high light holidays. in one worksheet Match works, the same formula does not work else where strange.

    Can someone help in excel, how to go about this.

    1. Hello Raj,

      It's difficult to advise anything without seeing your data. If you can post your sample workbook on our forums and describe what data you want to highlight, our support team will try to help.

  7. Hi,

    I have a date a document was sent out in A1 when it is returned I will fill the date in B1. If B1 is blank and there has been more than 28 days since A1 I want it red, how do I do this please?

    egA1 01/01/2015
    A2 Blank but todays date is 01/02/2015 so its more than 28 days since A1

    Thank you

  8. Hi,
    How to set Mandatory Field in Excel.
    Eg.
    Column A Column B
    -------------------------
    Name (A1) (B1)
    Emp No.(A2) (B2)
    Address (A3) (B3)
    Here I want to set mandatory cell for (B1). need message box if there is no text on that cell. Please help me.

  9. Hi,in my spreadsheet where i want to apply formula in following way please help me
    in E5 cell i have expiry date. But i want 30 days before from the expiry date in E5, cell turn into RED color otherwise remain Green
    Example expiry date in E5 is 30 April 2015 till 31st March E5 remains Green but as 1st april arrives my E5 turn into RED

    BEST REGARDS

  10. I have a weekly time and accounts sheet that I would like to apply some conditional formatting too.

    Our working day starts and finishes at Midday. I would like to use the today function for automation purposes, is it possible to use the today function + time?

    What I would like to do if the above could be used is

    (Todays Date is merged across cells A1, B1 and C1)

    Highlight Cells A2:C10 if cell A1 (A1:C1) = TODAY + 12 Hours

    Many thanks in advance

    Rob Ward

  11. dear mam
    i want to highlight the particular year dates example
    1) 21-dec-2011
    2) 22-jan-2012
    so form this i want to highlight numbers dates which contains same year , month,date
    so that the entire row should highlight. help me mam.

  12. Hi there,

    I've been using this formula:

    =TODAY()-$A2>120

    To highlight any entry that is more than 120 days old. Now, I have to do that for like 600 entries and I'm confused, How can I select 600 entries in the same column and apply the same principle without having to do it to each and every entry?

    I would appreciate any help. Thank you.

  13. Hello conditional format users. I am at a loss on this one. I would like to highlight a cell if the current date AND time is between a certain range.

    For example i have a list of people on duty, and i wish to highlight the person on duty between 17:00 on 1st to 08:00 the next day. How can this be achieved. Any help would be appreciated

  14. I put the following formula in ( =CELL("format",$H3)="D4" ) it changes the color of the correct cells when the date is entered BUT when I take the date out of that cell all of the cells remains highlighted. Is there anyway to fix this?

  15. i have a problem where to make icon to a cell contain date based another dates in another cells....example i wan to make icon for column N based on column k. so i can differentiate how many data is verified within tat date...pls help me tq

    column K Column N
    tat date verified date
    22/01/2015 23/01/2015
    23/01/2015 21/01/2015
    23/01/2015 22/01/2015

  16. hi I want answer of these statement(1)a project complete 24days before its given date show the completion date please tell me the formula(2) display project completion date as 18-december-2014 project start 35 days

  17. Hi

    I have a spreadsheet of tenders that we are applying for. I want to highlight the cells using a Amber and Red system for the due date of the tender, where if Today is within 7 days of the due date it is Amber, and 2 days of the due date, it turns Red.

    I have done this using the formula suggested above, but what I would like to do is, once the Status cell has been changed to say "submitted" the colour changes to green.

    My current formula for the formatting is:

    =AND($F96-TODAY()>=0,$F96-TODAY()<=2)

    How do I need to change it to get it to do what I need?

    Does that make any sense at all??

  18. I have a spreadsheet that contains various dates stating when a task was accomplished that happened in the past. I need a formula that will fill the cell to various colors based on when they will be due for the same task but a year later ie. 90 days out to be green, 60 days out to be yellow and 30 days out red. The value in each cell only states when the task happened as opposed to when the next task will need to occur (essentially adding one year to the date in the cell). How can this be done? Thanks in advance

    1. Also, within 1 week or overdue to be black, sorry about that, thanks.

  19. I have a spread sheet that shows the months (example Feb 1, 2014) when a vehicle needs to go in for inspection; how do I have the cell with the date in it, change color at the beginning of the month stated in the cell, and then change back to the original color when the month has ended?

  20. follow up.. i tried this formula =WEEKDAY(D$6,1)>6, yes finally hi-lited the fridays but also hi-lited the last date of the month which is not friday, and Using this formula =WEEKDAY(C$6,1)>6 highlighting saturdays. 'want fridays to be hi-lited.

  21. hi SVET, I want only fridays as a weekend of the month, any solution using conditional formatting, your given example is for 2 days weekend and it's sat and sun. i tried this formula =WEEKDAY(DATE($C$3,$C$2,C$5),1)>6 but it was Saturdays being hi-lited, what i want is the fridays only, i tried more formulas but i failed. suggestion please.

  22. Dear Concern,

    kindly let me formula for finding days like if today is Monday so after 61 days what will day come?

  23. Hi,

    Is there a way to automatically fill dates to show only Monday, Tuesday, Thursday, Friday. For example, using the fill weekday option but removing Wednesday in every row.

    What I want to do is to show the following but to auto fill the dates for the whole year without Wednesday, Saturday and Sunday.

    5/1/15
    6/1/15
    8/1/15
    9/1/15
    12/1/15
    13/1/15
    15/1/15
    16/1/15
    etc.

    Thank You

  24. I currently have this formula:
    =AND(TODAY()I2,LEN(K2)=0)
    The formula works perfectly, but it only works one time. I need the formula to reset when I change the dates for G2. When I change the date for G2, it changes H2 and I2.
    J2 is highlighted for the dates between H2 and I2, but it isn't highlighted when I type in a date in K2. However, I change the date in G2 every 60 days and it doesn't reset the formula to work again. Any help would be greatly appreciated! Thanks!

  25. I have a column with various dates [column b]. I want cell B1 to populate the next date in column B after today's date. Cell A1 is =today() for today's date. Column B has dates based on a 64 day cycle starting in 1977 all the way to 2050. I want B! to show the next date after today in the 64 day cycle. Thank you for your help. Great site!

  26. I inherited this sheet from some one with format cell that can only accept date in particular month and year. please how can undo it. the cell has been format to accept 01/01/14 and this 2015 but it will not accept 01/01/15, it comes back telling me that I can only input date within this month.

  27. I am tryimg to write a formula that says if the value of a specific cell is a 1 or 2, add 60 days to the date of another cell and place that date in a third cell. but if the value is 3 add 30 days to the date.

    So if A1 is a "1 0r 2" take the date in cell A2 and add 60 days to it and place the value in A3. If the value of A1 is a 3, take the date in cell A2 and add 30 days to it and place the value in A3

    1. Hi Mike,

      The following nested IF formula works a treat. Just copy it into the cell A3 and check if it returns the result you want:
      =IF(OR(A1=1,A1=2), A2+60, IF(A1=3, A2+30,""))

      Please make sure the cell A3 has the date format (you can simply copy the format of A2 into A3).

      Also, if the cell A1 contains any value other than 1,2 or 3, the formula will return an empty string.

  28. hello swetlana,

    i want to highlight my dates three days before into green and into red after date is expired.

    thnx in advance.

  29. i want to highlight my dates three days before, how can i do it pls..

  30. Hello, I can't figure out solution to my problem. I have a table with increasing date rows like this:
    Date Value
    3.11.2014 356540
    4.11.2014 356757
    4.11.2014 356758
    4.11.2014 356762
    5.11.2014 356793
    6.11.2014 356833
    6.11.2014 356838
    Is it possible to format that table so the colour of font (or whatever) changes randomly after every change of date. So the rows with same date will be differently highlighted? Thanks in advance, T

  31. Hello:

    I've done this before but, I am blanking on the excel formula that I used. I am trying to make an excel spreadsheet to remind me when my staff are in need of training based off days.

    example

    Green colored cell 12/12/2014 - 9/12/2015 Training is up to date

    Yellow colored cell 9/13/2015-12/11/2015 Training is about to expire

    Red colored cell 12/12/2015 Training is expired

    Please help and Thank you

    Very Respectfully,

    John

  32. Hi,

    I need help with conditional formatting. I have two columns that have dates. e.g. Col A (Entry Date) has date 02 December 2014. Col B (Exit Date) has date 01 December 2014. I want conditional formatting in all the cells in Col B when the date is less than the date in Col A.

    Hope it makes sense.

    Many thanks,
    Sam

    1. Hi Samuel,

      Select column B and create a conditional formatting rule using this formula:
      =B2<A2
      Assuming that row 2 is your first row with data.

  33. Hi I have been using the following formulas however for some reason it highlights the cell above not the cell with the date in it. =AND($A2-TODAY()>0,$A2-TODAY()<=30)

    1. Hi Teri,

      Using A2 in the formula implies that row 2 is the 1st row in the range to which the rule applies, please make sure it is really so. If you want to apply the rule starting with row 1, then replace $A2 with $A1 in the formula.

  34. Hello,

    How can I get something like this
    29/11/2014 00:00
    29/11/2014 00:15
    29/11/2014 00:30
    29/11/2014 00:45
    29/11/2014 01:00
    And so on, to get after 96 quarters 30/11/2014, and afterwards 01/12/2014?

    Thank you in advance!

    1. Hi Siva,

      If you need to have time with a 15-minute interval, please do the following:

      1. Enter the starting time in cell A1.
      2. Type this formula =A1+1/(24*4) into cell A2.
      3. Apply the Date format to cell A2 identical to A1.
      4. Copy the formula from cell A2 down to the other 94 rows.

  35. Good morning, Svetlana.

    I want to duplicate the date from A11 into D11 (A12 into D12, A13 into D13, etc.) without viewing the "1/0/1900" default throughout the spreadsheet. I believe I need to use an If/Then rule, but I have yet to find the correct formula. I used =IF(COUNT(H15)=1,K14-H15,"") for another set of cells, in order to keep the spreadsheet clean, as opposed to viewing default "#VALUE!". Can you help with my date dilemma??

    Thank you, in advance!

  36. Hello,

    I need help with trying to color coordinate a total based on which day of the week it is. The color needs to change based on the total in the cell.

    PLEASE HELP.

    thanks!

  37. Hi,

    Can someone please let me know if this is possible:

    Change the shade/color of the cell based on WHEN the value changed? For example, I have a cell with a drop down menu. Is there anyway I can highlight that cell if the value of that drop down menu hasn't changed in 2 weeks? Note that field in the cell is NOT a date, it is simply a text string.

    Thanks!

    1. Hello Shahbaz,

      Regrettably, formulas won't help you with your task. Most likely you need a special VBA script.

      1. That's what I figured, thanks.

  38. Hi,

    I have several rows filled with dates and I am looking for them to turn yellow when the date is 30 days away and red when the date has lapsed, I seem to be able to do this for a month at a time using the "conditional formatting" button but after the last month has passed it returns to its normal colour, in essence if the date is longer than one month in the past it will not highlight it. could I have a formula that will lengthen this time frame, a year or two would be helpful.

    Thanks

  39. I would like to make cell E4 put an X in the cell when cells F4:J4,L4,N4,U4,X4:Y4 have a date put in their cell.

    I have a spreadsheet to track training and E4 will show me that the orientation training has been completed should the other cells have a date in them.

    I was trying to use an IF function like this, however, the X will not remove if the date is deleted from the cells.

    =If(F4:J4,L4,N4,U4,X4:Y4=DATE),"X"," ")

    is there a better function to use?

    I have also tried to use conditional formatting but am unfamiliar with excel at this level.

    Thanks.

    1. Hello Josh,

      The shortest formula will be as follows:
      =IF( IFERROR(F4*G4*H4*I4*J4*L4*N4*U4*X4*Y4,0) >0, "X","")

      For the conditional formatting rule, you can use this formula:
      =IFERROR(F4*G4*H4*I4*J4*L4*N4*U4*X4*Y4,0) >0

      If you need to check each cell for the date, not simply for the number, I am afraid, the formula would be too long and complex.

      1. Thank you!

  40. Respected sir,

    How calculate ( old date + current date )in ms excel.

    I need my staff working days calculate daily automatically...

    Thanks For advance

    1. Hello AKBER,

      Just enter =A2+B2 and apply the Number format to the cell with the result.

      Or, you can use the datedif function to count the number of days between the dates:
      =datedif(A2,B2,"d")

  41. I am creating a spreadsheet that tracks the date a Patient STARTS a treatment in column F2-F20 and when a Patient STOPS treatment in column G2-G20. What I need is for column G2-G20 to highlight YELLOW when 5 days from the END of treatment and then highlight RED when treatment is done or past due. Example: "Big Bird" starts treatment on 11/15/2014 (entered in Cell F2) and his treatment ends on 11/29/2014 (entered in Cell G2). 5 days before 11/29/2014 Cell G2 should highlight in YELLOW and then on 11/29/2014 and after the Cell should highlight RED. Thank you for your time and help SVETLANA!

  42. I have a date(3-Nov-14) and the value in another column.Next month, i need to pick up the other value.

    Could you please help me out with the formula.

    Ex:- 03-nov-14 0.366
    01-Dec-14 1.36

    Thanks
    Sirish

  43. I'm going to create a Drop down box in excel, I have set of data (each data have single cell) followed
    100 Sales
    200 Finance
    300 IT
    400 Marketing
    500 Safety
    From this I need to display number only (eg. 100) My request, when I select 100 Sales, cell will display only the number 100, How it is possible to get.
    we need to use data validating and conditional formatting. please help me.

    1. Hello Naina,
      First off, let me check if my understanding of your task is correct. You have a dropdown list with entries like "100 Sales", in some cell, say A1. And you want to display "100" in another cell, say B1 when "100 Sales" is selected in A1.

      If so, just enter the following formula in cell B1, which retrieves the values from A1 until the first space:
      =LEFT(A1,FIND(" ",A1))

      1. Thanks for your reply.
        Is it possible to display in check box itself. Eg. If I select the check box text "100 Sales" after selecting It should be display "100" only. because this is for printing purpose, I need the numbers only 100, 200, 300 remaining's are reference purpose. otherwise any other option to do this.

        Note: I need the numbers only, corresponding word only for reference not for print. I hope you will be understand this.
        Thanking you and I'm waiting for your reply!

  44. Hi,

    Conditional formatting is much interesting. Can u plz tell me how to sort out the contents present in one column with the contents present in another column. I wants to highlight the contents present in one column only which are different from the contents present in another column. How can I do it?

    Waiting for your reply

    Regards,

    Farhan Khalid

    1. Hello Farhan,

      You can create a rule to highlight cells in column A whose values are not the same as in column B with this formula:

      =A2<>B2 (assuming that row 2 is your first row with data)

  45. Hi Svetlana,
    I'm hoping you can help - you seem to be extremely knowledgeable when it comes to Excel and conditional formatting - Very advanced stuff!

    I'm trying to set conditional formatting where the dates in the future so they will turn automatically in a particular colour, more than 2 months green, 2 months and less (amber) and 1 month and less (red).

    I can't seem to find it in the formula drop down list for these particular timescales.

    Your help will be very much appreciated.

    Let me know if you need any more info.

    Many thanks again

    Vincenzina

    1. Hi Vincenzina,

      Regrettably, you cannot create a rule that will work based on months, since the number of days in each month varies.

      Alternatively, you can create the rules based on the number of days, like these:

      Green (in more than 60 days): =$A2-TODAY()>60

      Amber (in 60 to 31 days): =AND($A2-TODAY()>=31, $A2-TODAY()<=60)

      Red (in 30 days and less): =AND($A2-TODAY()>=1, $A2-TODAY()<=30)

      The current date and past dates won't be colored.

      1. Hi Svetlana,

        many thanks for your swift reply.
        I have tried to set this formula but it I get an error message saying 'You cannot use relative references in Conditional Formatting criteria for colour scales, data bars and icon sets.

        Is there another way I could set the formatting?

        Many thanks

        Vincenzina

        1. Hi,

          Sorry, I managed to figure this out.

          Many thanks again!

          Vincenzina

  46. Greetings Svetlana,

    Your tips are very helpful! I've been trying unsuccessfully to add one of the previously explained formulas to a spreadsheet I have, but no luck.

    I'm in need of a formula that I can use with custom colors. I added the =TODAY() to my A1, which gives me today's date every time I open it. Now what I'm trying to do is add 3 different colors to a cell lets say "I4".
    From today's date to 90 days = custom color; from 91 to 120 days = custom color; and from 121 to 180 days = custom color all of them within the same cell. Hopefully, I explained myself correctly and any info you can provide will be greatly appreciated. Thanks in advance!

    Regards,
    Ivan

    1. Hello Ivan,

      Try creating the rules for I4 with these formulas:

      From today to 90 days (including today): =AND($I4-$A$1>=1, $I4-$A$1< =90) From 91 to 120: =AND($I4-$A$1>=91, $I4-$A$1< =120) From 121 to 180: =AND($I4-$A$1>=121, $I4-$A$1< =180) Instead returning the current date in A1, you can use the TODAY() function directly in the formulas, e.g. From today to 90 days: =AND($I4-TODAY()>=1, $I4-TODAY()< =90)

  47. Hi

    Thanks for the very helpful information you publish. I've been trying to work out how to do a specific task in XL2013 and seem to keep mucking it up. please help me

    I have a mix of dates spread across many rows and columns. Based on the =today() I what to format as follows

    any date from today to 36 months ago to be green
    any date from 36 months ago to 60 months ago to be yellow
    any date greater than 60 moths ago to be red.

    i keep getting errors and not all colours showing

    I also have a problem with all empty cells being coloured and i would like them to stay white.

    Can you please help me

    Thanks in advance
    Kevin

    1. Hello Kevin,

      I don't know a way to create a rule that will work based on months, since the number of days in each month varies.

      Alternatively, you can create the rules based on the number of days, like these:

      Green (from today to 36 days ago): =AND(TODAY()-$A2>=0, TODAY()-$A2<=36)

      Yellow (from 37 to 60 days ago): =AND(TODAY()-$A2>=37, TODAY()-$A2<=60)

      Red (more than 61 days ago): =$A2-TODAY()>=61

  48. I don't think this has been answered here.

    What if you want a range of cell each with a range of different dates yet you want them all follow the same rules regarding their change in colour leading up to the date specific related to each individual specific cell?

    So one cell may have a date of 1/1/15 and another may have a date 20/1/15 they may turn different colours as you get closer to the date each time you open up the spreadsheet, but the earlier date will change colour sooner than the later one.

    1. Hello Oliver,

      You can achieve this by creating a few rules with different colors for your dates. For example:

      Yellow (due in 1 to 20 days): =AND($A2-TODAY()>0,$A2-TODAY()<=20)

      Red (due in 21 to 40 days): =AND($A2-TODAY()>20,$A2-TODAY()<=40)

      And so on.

  49. Hello Jill,

    If the expiry date is calculated based on the current date, you can write the formulas using the Today() function:

    Red:=$A2<TODAY()

    Yellow (expires in 1 to 30 days): =AND($A2-TODAY()>0,$A2-TODAY()<=30)
    or
    Yellow (expires exactly in 30 days): =$A2-TODAY=30

    Green (expires in 30 to 60 days): =AND($A2-TODAY()>30,$A2-TODAY()<=60)
    or
    Green (expires exactly in 60 days): =$A2-TODAY=60

  50. I am creating a matrix to track training tickets. I need the matrix to tell me when tickets will expire,(expired, 30,60) I will then need to add the red color to the expired tickets, Yellow to tickets that will expire in 30 days, and Green for tickets that will expire in 60 days.

    Can you help out.

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