Comments on: How to add and subtract dates, days, weeks, months and years in Excel

In this tutorial, you will find a variety of useful formulas to add and subtract dates in Excel, such as subtracting two dates, adding days, months and years to a date, and more. Continue reading

Comments page 9. Total comments: 300

  1. I need to calculate no of appointments today basing on date from 1) Data Sheet to dash boadrd

    Prabhakar T Total Number of Meetings the day 3-Jul-16 from data sheet containing the date

  2. I am looking for a similar calculation as SElizabeth. What I need is a gestational age calculated from a specific due date on a specific date. All I can locate is a formula that gives a calculation based on todays date...which of course will change the resulting value each day. I need for the result to be a fixed value.

    The formula I have is: =FLOOR(279-(K2-TODAY()),7)/7&" weeks "&MOD(279-(K2-TODAY()),7)&" days"

    The K2 value is clients due date. When I try to substitute the TODAY value for a cell that contains the date I want this to calculate off of, I get an error.

    I don't understand excel at all...so I am stuck!

    Any ideas?

    Thanks

  3. I'm trying to develop a spreadsheet of pregnant patients, and I need a formula to calculate today's gestational age from due date. The output would be something like "35 2/7", meaning 35 weeks and 2 days gestation. Here's the Google Sheets formula that does not work in Excel:

    =ArrayFormula(if(A1:A,int((280-(A1:A-today()))/7)&ʺ ʺ&mod(280-(A1:A-today()),7)&ʺ/7ʺ,iferror(1/0)))

  4. Hi,

    I have added 12 months to a date in column E4, but if there is not a date to add to (E4 is blank) then the date shows 31/12/1900. How do I make the cell blank rather than 31/12/1900? I'm having trouble adding an IFBLANK function to the below formula. Thanks :)

    =EDATE(E4,12)

  5. subtract 5/13/2016 1:20:39 AM- 5/13/2016 12:00:00 AM
    to find out result in hh:mm:ss

  6. Great information, exactly what I was looking for!

  7. I want to calculate how many years is remaining or expired for the lifetime of equipment from the actual date.
    Thanks

    In service Life Calc end
    date Time date
    14-Feb-05 15 11/Feb/20
    14-Feb-05 15 11/Feb/20
    10-May-03 10 07/May/13
    10
    22-Jul-12 10 20/Jul/22
    10
    22-Jul-12 10 20/Jul/22
    10-May-03 15 06/May/18

  8. hi,

    Wednesday, June 01, 2016
    i want to split day and date so how to possible ?

    1. Hello Hiren,

      If your original values are dates, you can use the following formulas:

      To extract the day of the week: =TEXT(A2, "dddd")
      To extract the date: =TEXT(A2, "mmmm dd, yyyy")

      If your original values are text strings, then use these ones:

      To extract the day of the week: =LEFT(A2, FIND(",", A2)-1)
      To extract the date: =RIGHT(A2, LEN(A2)-FIND(",", A2)-1)

  9. Thanks Svetlana, im new to this!

  10. =IFERROR(MONTH(BA5),"") IS RETURNING 1

    1. Hi Dan,

      Just use IF instead of IFERROR:

      =IF(BA5="","", MONTH(BA5))

  11. If I have no date can I return a blank cell?

  12. Hi, I'm trying to organize a schedule for work.

    My sheet is set up so that the person creating the schedule (usually me) enters the Month in a cell, and the week number in another cell (Week number of the year, but could be of the month if it's simpler).

    Once these two fields are entered, I'd like a group of cells to be updated with the dates.

    For example:

    Week Number: 22
    Month: June

    30 31 1 2 3 4 5

    I haven't found any information on how to accomplish this.

  13. Hey. I have been trying to calculate the hours spent working on a task, excluding daily breaks of 1:30.
    I also do not want to count non working hours. The day starts at 09:00, a break from 13:00-14:00, finishing at 17:00. Some of the tasks may take three days and even span over a (non working) weekend. Cheers.

    START, FINISH , TIME_ON_TASK??
    05-Apr-16 9:00, 06-Apr-16 14:00 =??:?? hours worked on task.
    05-Apr-16 9:00, 05-Apr-16 17:00
    06-Apr-16 11:00, 06-Apr-16 13:00
    05-Apr-16 0:00, 05-Apr-16 0:00
    05-Apr-16 0:00, 05-Apr-16 0:00
    05-Apr-16 0:00, 05-Apr-16 0:00

  14. Hi,
    I am trying to create a formula that can take a date in cell A1 and add months from A2 and give me a date in A3.
    The problem is I need to be able to change A1 or A2 without changing the formula and I want to copy this to about 600 cells.
    Thanks in advance for your help.

  15. Hi

    Need help to get formula for calculating overall experience. Ex, my previous experience is 3.6 years. My current experience started from 06-June-2012(this exp is calculated using dated if). How to calculate the exact total years of experience in excel(previous number + current)?

    Thanks to help.

  16. Need some help please and thanks in advanced.

    if I have a date in a cell 08/10/2016 and in the cell to the left of it I like the this date less a month.
    eg from 08/10/2016 to now read 08/09/2016

    thanks again guy's

  17. What if I want to know the number of employees given the hired date and end of contract?

  18. I am trying to add up hours worked in a month.
    Cells are custom formatted: [hh]:mm
    I used the formula D5=Text(C5-B5, :hh:mm") to get the hours worked on a particular day.
    Then I use =sum(D5:D35) to get the month total but the result is 00:00.
    How do I get this column to add up
    Many thanks
    It's a very useful site.

  19. How do i get a a cell to show a specific day before a specified date.

    I need a cell to show the Thursday before any specified date.

    IE cell C2 needs to show the date for the Thursday before the date in cell D2

    Thanks
    Ash

    1. Thanks Samantha, that's not quite what I mean though.

      Say I have today's date (24/04/2016) in cell D2, I need cell C2 to tell me the date for Thursday last week (21/04/2016) but also if I have say tomorrow or Wednesdays date in D2 I still need it to return the previous Thursday (21/04/2016)

      Hope that makes sense

    2. suppose you have date in D2 then you can put the formula in C2
      =text(D2,"dddd")

      help-
      "d" - only date will come
      "dd"- only date will come
      "ddd"- Mon, Sun. wed
      "dddd" - Monday, Tuesday, saturday

  20. hi
    i need to add or subtract time using now() function and entered value in time format only
    4/19/2016 9:06 5:05:00 PM 42478.67
    when tried I am getting the above value please help

  21. Hi guys,

    Please advise on below

    how to modify the next formula formulation for the following:

    If= required date less than 5 weeks,"check","no check)

  22. how can I do in one excel box to show a week like
    Jan 01, 2016 to Jan 07, 2016
    Jan 08, 2016 to Jan 14, 2016
    and so on

    I can do manually but I want to do it in a formula.
    Thanks

  23. Joining Date last date Previous Experience Total Year Experience Grand Total Experience
    25-May-14 1-Jan-16 5 years 3 months 1 years, 7 months, 7 days
    7-Oct-14 31-Mar-16 4 years 2 months 1 years, 5 months, 24 days
    21-Jan-15 24-Mar-16 3 years 9 months 1 years, 2 months, 3 days

    please help how to add Previous Experience to Total year experience....

    1. Sorry, it's hard to think about ways of getting data without seeing your table. If the "Previous Experience" column has a string value, you can try the following:

      To get the number of years and months from Previous Experience you can use formulas like these:
      =LEFT(D3, SEARCH(" ", D3, 1)) - for years

      =MID(D3, SEARCH("years", D3, 1)+5, SEARCH("months", D3, 1) - (SEARCH("years", D3, 1)+ 5)) - for months

      If the "Total Year Experience" column is countable, add the results to the formula for this column.

  24. The formula "How to add / subtract months to date in Excel" have a gap with date 29

    If I add 1 month from 29/01/2016 to 29/01/2017, the month of February gone missing.

    I manually solve the question, but needed to go deeply. THANK YOU.

  25. I want to add X number of days to the date is cell A2, showing the resulting date in cell B2. However, if I use =A2+1 (for example) to add one day to the date in A2, but no date has yet been entered in A2, then the display in B2 is "VALUE". Is there a way to not have that display, leaving B2 blank until a date is entered in A2, whereupon B2 would display the date according to the formula?

  26. I need a formula to identify any help desk ticket created between today at 12:01am and a week ago at 12:01am.

    So, in essence, I need to create a formula that says this:
    (If Ticket_Opened_date is between (today at 12:01am - 7 days) and (today at 12:00am), "New", "Old").

    The trouble is the part about it being at 12:01am and making sure the formula is dynamic so I don't have to recreate it each week. Note: Please trust me when I say I can't do it via the standard date filter options (so don't even bother suggesting that).

    Can someone help?

    1. Hello, Ruthie.

      I think that the following formula should work for your task:

      =IF(AND(D17>(NOW() - HOUR(NOW())/24 - MINUTE(NOW())/24/60 + 12/24 -7),D17>(NOW() - HOUR(NOW())/24 - MINUTE(NOW())/24/60 + 12/24 -7)), "New", "Old")

  27. Just like the comment 3 above i need to calculate the differences between dates to get a format like 2yrs, 3months, 5days, 7hrs and 25min

    for example difference between 20/10/2014 9:34 and 13/12/2016 17:20.to get
    2years, 1month, 23days, 16hrs, 14min.

    1. Hello, Bola,

      Please try this formula:
      =IF(DATEDIF(A2,B2,"y")=0,"",DATEDIF(A2,B2,"y")&" years ")&IF(DATEDIF(A2,B2,"ym")=0,"",DATEDIF(A2,B2,"ym")&" months ")&IF(DATEDIF(A2,B2,"md")=0,"",DATEDIF(A2,B2,"md")&" days") &" " &TEXT(ABS(A2-B2), "h") & " hrs" &" " &TEXT(ABS(A2-B2), "mm:ss") & " min "

  28. Hi,
    I'm trying to create an If function that would evaluate a score, then based on that score value predict a future test date based off of the date the first test was taken. Here are two examples:

    1.) TESTED: 1/1/2015 SCORE:>70 NEXT TEST:12 months from first date(1/1/2016) 2.) TESTED: 1/1/2015 SCORE:<70 NEXT TEST:6 months from first date(7/1/2016) Do you have any idea how to format this correctly? Every time I try, I end up with either an error, or the result of my text. Thanks!

  29. Is there a way to calculate the number of years between four dates? I want to calculate years of employee service where there was a lapse in employment:
    Start date 8/22/2005, End date 8/13/2008 = x years PLUS Start date 7/1/2009, End date 1/19/2010 = TOTAL YEARS. I tried adding two dated ifs together but it didn't work EG: =DATEDIF(A1,A2,"Y")+(DATEDIF(B1,B2,"Y"). (Answer s/b 3 years) Thx!

    1. Hello, Barbara,

      DATEDIF(A1,A2,"Y") returns the number of complete years. In your case 2+0 is 2. To get the correct result you need to sum 2 intervals and count the number of complete years using DateDIf:
      =DATEDIF(0,(A2-A1+B2-B1),"Y")

  30. How can I subtract in excel for below issue?

    [d/m/y h:m AM/PM-d/m/y h:m AM/PM]and note that fri and sat will be excluded from the calculation

  31. Hi Jules,

    I assume that the data relating to dates must be a part of a greater data range. The solution to this is as follows:

    Convert the data range to a Table using the Ctrl-T function. You will observe that all the column headings will have a drop-down filter. Click on the filter of the date column and select Date-filters - you will see a wide range of options. In excel 2013 there are 20 options with two more custom options.
    I am sure that you will be able get the required results you need.

    The specific requirement for this sort of filtering is the data in the date column should be entered in date format as per excel predefined formats.

    Regards,
    Ramki

  32. Hi Irfan,

    The simplest format I can assume from what you specify is as follows:

    Step 1 - Cell A1 type in the "From" date.
    Step 2 - Cell B1 type in the "To" date.
    Step 3 - Cell C1 type in the fomula "=B1-A1+1. We add one to include the start date. You will then get the number of days.
    Step 4 - In Cell D1 enter the formula to multiply Cell C1 by 24 to get the hours.
    Step 5 - In Cell E1 multiply Cell D1 by 60 to get the number of minutes.
    Note - If you enter the date function in Cell B1 as "=NOW()" then you will get the live time set in excel. This will assist you in getting the calculation of days and minutes, in decimal point, if you wish to.

    Regards,
    Ramki

  33. Hi,

    I have some issue to while calculating "FROM" "TO" example :
    FROM 02/01/2016 11:14:13 AM
    TO 05/01/2016 11:14:13 PM
    How can I separate in above date
    - How many Days
    - How many Hrs.
    - How many minutes

    Thanks

    1. You can follow below steps-
      1. Formate cells- Select date formate as (MM/DD/YY TIME)(03/14/01 1:30PM) change for both cells.
      2. Type below formula as it is-
      =INT(B3-A3)&"Days,"& HOUR(B3-A3) &"hours,"&MINUTE(B3-A3)&"Minutes and"&SECOND(B3-A3)& D3"Second"

      3.If your date is 1st Feb to 1st May then result as below-
      From To Result
      From To Result
      2/1/16 11:14 AM 5/1/16 11:14 PM 90Days,12hours,0Minutes and0Second

      4.And If your date is 2nd Jan to 5th Jan then result as below-
      From To Result
      1/2/16 11:14 AM 1/5/16 11:14 PM 3Days,12hours,0Minutes and0Second

      Regards
      Mangal

  34. Hello,

    I have a long list of records each with a date. I would like to filter my list to only show recent records dated today or within the last 21 days. I cannot find a way to do this despite reading lots of suggestions for date formulas. Please can you help?

    Thanks, Jules

  35. My query Cell
    A1 - 01-jan-2016, i want to make
    B1 - 11-jan-2016,
    C1 - 21-jan-2016
    D1 - 31-Jan-2016,
    E1 - 01-Feb-2016,
    F1 - 11-Feb-2016,
    G1 - 21-Feb-2016,
    H1 - 28-Feb-2016,
    I1 - 01-Mar-2016.........

    Or
    A1 - 01-jan-2016, i want to make
    B1 - 11-jan-2016,
    C1 - 21-jan-2016
    D1 - 31-Jan-2016,
    E1 - 11-Feb-2016,
    F1 - 21-Feb-2016,
    G1 - 28-Feb-2016,
    H1 - 10-Mar-2016.......

  36. Hello,
    how do I determine the difference between 2 dates, and also show a "0" if the start date is greater than the end date

    1. Hi Mechele,

      You can use a simple IF formula, for example:

      =IF(A1>B1, 0, B1-A1)

      Where A1 is the start date and B1 is the end date.

      In a similar manner, you can use the DATEDIF function to calculate the difference between two dates in days, weeks, months or years:

      =IF(A1>B1, 0, DATEDIF())

  37. HELLO, I try count between two date (10-12-1990 & 5-1-2016) by use datedif in many computer the result some computer true (25 year 0 month 30 day) and another computer the result false (25 year 0 month 143 day) why the day (143) I cant find the place changed properties in excel to get to same first result.

    .....thank for answer me.

    1. Hello, Salah,

      The problem may be caused by the difference in Date formats. Please send us your formula to check.

  38. Hi

    12/21/2015 8/15/1975

    40-Yrs And 4-Months

    =DATEDIF(E11,D11,"y")&"-Yrs"& " And " & DATEDIF(E11,D11,"ym")&"-Months"

    May be helpful :
    Interval-Meaning
    m Months
    d Days
    y Years
    ym Months Excluding Years
    yd Days Excluding Years
    md Days Excluding Years And Months

    1. Why doesn't it works with negative yrs/mos/days?

    2. It doesn't work with negative yrs/mos/days

    3. Wow.... Wonderful. Thank u

    4. Wow, thank you for sharing this. :)

  39. Nice Article.

  40. How to subtract two dates like

    12/21/2015 - 8/15/1975

    How to get the answer to be 40 Yrs and 4 Months

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