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, weeks, months and years to a date, and more.

If you have been following our tutorials to working with dates in Excel, you already know an array of formulas to calculate different time units such as weekdays, weeks, months and years.

When analyzing the date information in your worksheets, you are likely to perform some arithmetic operations with those dates too. This tutorial explains a few formulas for adding and subtracting dates in Excel that you may find useful.

How to subtract dates in Excel

Supposing you have two dates in cells A2 and B2, and now you want to subtract one date from the other to know how many days are between these dates. As is often the case in Excel, the same result can be achieved in several ways.

Example 1. Subtract one date from the other directly

As you probably know, Microsoft Excel stores each date as a unique serial numbers beginning with 1 that represents January 1, 1900. So, you are actually subtracting two numbers, and an ordinary arithmetic operation works without a hitch:

=B2-A2

Example 2. Subtract dates using Excel DATEDIF function

If the above formula looks too plain, you can achieve the same result in a guru-like way by using Excel's DATEDIF function:

=DATEDIF(A2, B2, "d")

The following screenshot demonstrates that both calculations return identical results, except for row 4 where the DATEDIF function returns the #NUM! error. Let's figure out why that happens.

When you subtract a more recent date (6-May-2015) from an earlier date (1-May-2015), the subtraction operation returns a negative number (-5) exactly as it should. The syntax of the Excel DATEDIF function, however, does not allow the start date to be greater than the end date and therefore it returns an error.
Subtracting two dates in Excel

Example 3. Subtract a date from the current date

To subtract a date from today's date, you can employ either of the above formulas. Just use the TODAY() function instead of date 1:

=TODAY()-A2

or

=DATEDIF(A2,TODAY(), "d")

Like in the previous example, both formulas work fine when today's date is greater than the date you are subtracting from it, otherwise DATEDIF fails:
Subtracting a date from the current date in Excel

Example 4. Subtracting dates with Excel DATE function

If you prefer to supply the dates directly in the formula, then enter each date using the DATE(year, month, day) function and then subtract one date from the other.

For instance, the following formula subtracts 15-May-2015 from 20-May-2015 and returns the difference of 5 days:

=DATE(2015, 5, 20) - DATE(2015, 5, 15)
Subtracting dates using the Excel DATE function

Wrapping up, when it comes to subtracting dates in Excel and you want to find out how many days are between two dates, it makes sense to go with the easiest and most obvious option - simply subtract one date directly from another.

If you are looking to count the number of months or years between two dates, then the DATEDIF function is the only possible solution and you will find a few formula examples in the next article that will cover this function in full details.

Now that you know how to subtract two dates, let's see how you can add or subtract days, months, or years to a given date. There are a number of Excel functions suitable for this purpose, and which one you use depends on which unit you want to add or subtract.

How to subtract or add days to date in Excel

If you have a date in some cell or a list of dates in a column, you can add or subtract a certain number of days to those dates using a corresponding arithmetic operation.

Example 1. Adding days to a date in Excel

The general formula to add a specified number of days to a date in as follows:

Date + N days

The date can be entered in several ways:

  • As a cell reference, e.g. =A2 + 10
  • Using the DATE(year, month, day) function, e.g. =DATE(2015, 5, 6) + 10
  • As a result of another function. For example, to add a given number of days to the current date, use the TODAY() function: =TODAY()+10

The following screenshot demonstrates the above formulas in action. The current date at the moment of writing was 6 May, 2015:
Adding days to a date in Excel

Note. The result of the above formulas is a serial number representing the date. To get it displayed as a date, select the cell(s) and press Ctrl+1 to open the Format Cells dialog. On the Number tab, select Date in the Category list, and then choose the date format you want. For the detailed steps, please see How to change date format in Excel.

Example 2. Subtracting days from a date in Excel

To subtract a given number of days from a certain date, you perform a usual arithmetic operation again. The only difference from the previous example is that you type the minus sign instead of plus :)

Date - N days

Here are a few formula examples:

  • =A2-10
  • =DATE(2015, 5, 6)-10
  • =TODAY()-10

Subtracting days from a date in Excel

How to add or subtract weeks to date

In case you want to add or subtract whole weeks to a certain date, you can use the same formulas as for adding / subtracting days, and simply multiply the number of weeks by 7:

Adding weeks to a date in Excel:

cell+ N weeks * 7

For example, you add 3 weeks to the date in A2, use the following formula: =A2+3*7.

Subtracting weeks from date in Excel:

cell - N weeks * 7

To subtract 2 weeks from today's date, you write =TODAY()-2*7.

How to add / subtract months to date in Excel

If you want to add or subtract a certain number of whole months to a date, you can employ either the DATE or EDATE function, as demonstrated below.

Example 1. Add months to a date with Excel DATE function

Taking a list of dates in column A for example, type the number of dates you want to add (positive number) or subtract (negative number) in some cell, say C2.

Enter the following formula in cell B2 and then drag the corner of the cell all the way down to copy the formula to other cells:

=DATE(YEAR(A2), MONTH(A2) + $C$2, DAY(A2))
Adding months to a date with Excel DATE function

Now, let's see what the function is actually doing. The logic behind the formula is obvious and straightforward. The DATE(year, month, day) function takes the following arguments:

  • the year of the date in cell A2;
  • the month of the date in A2 + the number of months you specified in cell C2, and
  • the day of the date in A2.

Yep, it's that simple :) If you type a negative number in C2, the formula will subtract months instead of adding them:

Adding / subtracting months to a date with Excel DATE function

Naturally, nothing prevents you from typing the minus sign directly in the formula to subtract months from a date:

=DATE(YEAR(A2), MONTH(A2) - $C$2, DAY(A2))

And of course, you can type the number of month to add or subtract in the formula instead of referring to a cell:

=DATE(YEAR(date), MONTH(date) + N months, DAY(date))

The real formulas could look similar to these:

  • Add months to date: =DATE(YEAR(A2), MONTH(A2) + 2, DAY(A2))
  • Subtract months from date: =DATE(YEAR(A2), MONTH(A2) - 2, DAY(A2))

Example 2. Add or subtract months to a date with Excel EDATE

Microsoft Excel provides a special function that returns a date that is a specified number of months before or after the start date - the EDATE function. It is available in all versions of Excel 2007 and higher.

In your EDATE(start_date, months) formulas, you supply the following 2 arguments:

  • Start_date - the start date from which to count the number of months.
  • Months - the number of months to add (a positive value) or subtract (a negative value).

The following formula used on our column of dates yields exactly the same results as the DATE function in the previous example:

Adding or subtracting months to a date with Excel EDATE formulas

When using the EDATE function, you can also specify the start date and the number of month to add / subtract directly in the formula. Dates should be entered by using the DATE function or as results of other formulas. For example:

  • To add months in Excel:

    =EDATE(DATE(2015,5,7), 10)

    The formula adds 10 months to 7-May-2015.

  • To subtract months in Excel:

    =EDATE(TODAY(), -10)

    The formula subtracts 10 months from today's date.

Note. The Excel EDATE function returns a serial number representing the date. To force Excel to display it as a date, you should apply the Date format to the cells with your EDATE formulas. Please see Changing the date format in Excel for the detailed steps.

How to subtract or add years to date in Excel

Adding years to a date in Excel is done similarly to adding months. You use the DATE(year, month, day) function again, but this time you specify how many years you want to add:

DATE(YEAR(date) + N years, MONTH(date), DAY(date))

In your Excel worksheet, the formulas may look as follows:

  • To add years to a date in Excel:

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

    The formula adds 5 years to the date in cell A2.

  • To subtract years from a date in Excel:

    =DATE(YEAR(A2) - 5, MONTH(A2), DAY(A2))

    The formula subtracts 5 years from the date in cell A2.

If you type the number of year to add (positive number) or subtract (negative number) in some cell and then refer to that cell in the DATE function, you will get a universal formula:

Subtract or add years to a date in Excel

Add / subtract days, months and years to date

If you carefully observed the two previous examples, I think you have already guessed how to add or subtract a combination of years, months and days to a date in a single formula. Yep, using the good old DATE function :)

To add years, months, days:

DATE(YEAR(date) + X years, MONTH(date) + Y months, DAY(date) + Z days)

To subtract years, months, days:

DATE(YEAR(date) - X years, MONTH(date) - Y months, DAY(date) - Z days)

For example, the following formula adds 2 years, 3 months and subtracts 15 days from a date in cell A2:

=DATE(YEAR(A2) + 2, MONTH(A2) + 3, DAY(A2) - 15)

Applied to our column of dates, the formula takes the following shape:

=DATE(YEAR(A2) + $C$2, MONTH(A2) + $D$2, DAY(A2) + $E$2)

Add / subtract days, months and years to date

How to add and subtract times in Excel

In Microsoft Excel, you can add or subtract times using the TIME function. It lets you operate on time unites (hours, minutes and seconds) exactly in the same way as you handle years, months and days with the DATE function.

To add time in Excel:

cell + TIME(hours, minutes, seconds)

To subtract time in Excel:

cell - TIME(hours, minutes, seconds)

Where A2 contains the time value you want to change.

For example, to add 2 hours, 30 minutes and 15 seconds to the time in cell A2, you can use the following formula:

=A2 + TIME(2, 30, 15)

If you want to add and subtract time unites within one formula, just add the minus sign to the corresponding values:

=A2 + TIME(2, 30, -15)

The above formula adds 2 hours and 30 minutes to the time in cell A2 and subtracts 15 seconds.

Alternatively, you can enter the time unites you want to changes in some cells, and refer to those cells in your formula:

=A2 + TIME($C$2, $D$2, $E$2)

Adding and subtracting times in Excel

If the original cells contain both date and time, the above formula works perfectly too:
Adding and subtracting times to a date and time

Date & Time Formula Wizard - quick way to add and subtract dates in Excel

Now that you know a bunch of different formulas to calculate dates in Excel, wouldn't you want to have just one that can do all this? Of course, such a formula can never exist. However, there exists the Date & Time Wizard that can build any formula for you on the fly, provided that you have our Ultimate Suite installed in your Excel. Here's how:

  1. Select the cell in which you want to insert the formula.
  2. Head to the Ablebits Tools tab, and click the Date & Time Wizard button:
    Date & Time Formula Wizard for Excel
  3. The Date & Time Wizard dialog window shows up. Depending on whether you want to add or subtract dates, switch to the corresponding tab, supply data for the formula arguments, and click the Insert Formula button.

As an example, let's add a few months to the date in cell A2. For this, you go to the Add tab, type A2 in the Enter a date box (or click in the box and select the cell on the sheet), and type the number of months to add in the Month box.

The wizard makes a formula and shows its preview in the cell. It also shows the calculated date under Formula result:
Building an Excel formula to add months to date

If you are satisfied with the result, click the Insert formula button. Once the formula is added, you can copy it to as many cells as necessary:
The formula to add months to date

That was quite a simple formula, wasn't it? Let's give the wizard something more challenging to work on. For example, let us subtract some years, months, weeks and days from the date in A2. To have it done, switch to the Subtract tab and type the numbers in the corresponding boxes. Or you can enter the units in separate cells and supply references to those cells, as shown in the screenshot below:
Making a formula to subtract years, months, weeks and days from date

Clicking the Insert formula button inputs the following formula in A2:

=DATE(YEAR(A2)-D2,MONTH(A2)-E2,DAY(A2)-G2-F2*7)

If you plan to copy the formula to other cells, you have to change all cell references except A2 to absolute references so that the formula copies correctly (by default, the wizard always uses relative references). To fix the reference, you simply type the $ sign before the row and column coordinates, like this:

=DATE(YEAR(A2)-$D$2,MONTH(A2)-$E$2,DAY(A2)-$G$2-$F$2*7)

And get the following results:
The formula to subtract years, months, weeks and days from date

Additionally, you can click the Show time fields link and add or subtract date and time units with one formula.

If you wish to play with the Date & Time Formula Wizard in your own worksheets, you are welcome to download the 14-day trial version of the Ultimate Suite.

This is how you add and subtract dates in Excel. I am hopeful you have learned a couple of useful functions today. I thank you for reading and hope to see you on our blog next week.

300 comments

  1. I need urgent help ..

    i need to add (N) number of days to costume date ( DD/MM/YYYY) with excluding Friday and calculate Thursday as half day .

    Meaning :
    operation take 23 days
    today date : 1/1/2017
    Friday is off and Thursday half day working ..

    i want to know the date when operation end .

    any help

  2. Hello,

    I am trying to calculate a result in where I can determine an expiration date of a specific date within 1 month.

    Example- Start Date is 2/17/2016 and End date is 02/16/2017. I would like to create a formula that will be able to tell me when the end date expires
    1 month before.

    Is that possible and how can I use the Edate and Today formula to get that calculation?

    Thank you in advance for your help!

    Melissa I

  3. Hi i am trying to work out days elapsed on a task

    Start Date - Completed date (this is easy) but if the item is not closed and no date is entered i want Todays date to be default

    Please help

  4. I can not for the life of me figure out how to do this!
    I want to track how long staff spend on task.
    They put the date & time started and the date & time they finish.
    I need to get the total hours & minuted (hh:mm)working.
    Deduct :30 for break and 1:00 for lunch. Then if the start and finish is greater than a day, subtract the 15 hours (overnight)

    H1[START] = 24/11/2016 09:45
    I1[FINISH] = 25/11/2016 08:35
    J1=[TIMEWORKED] ??? (hh:mm)

    Work day is from 06:00 - 15:00
    Break from 09:00 - 09:30
    Lunch from 11:00 - 12:00

    I need to do this macro free. I have been trying to sold this for ages. Looked all over the internet. What I have established is that I need to show the times as general formatting do the calculations and then display the result as hh:mm. My head aches trying to resolve the calculations though.

    Any help, ideas, advice??
    Cheers
    Steve

  5. Hi all,

    Following this thread and trying to create a list in Column A to reflect a weekly schedule with the value in A3 being the baseline and incrementing A4, A5, etc... by 7 days, simple stuff based on this site... so I thought... ;)

    Desired results
    Cell A3 - 1/10/2017
    Cell A4 - 1/17/2017
    Cell A5 - 1/24/2017
    etc...

    Current configuration
    Cell A3
    - Format: Date (3-14-2012 from Date format Type list)
    - Current value: 1/10/2017

    Cell K1
    - Format: Number
    - Current value: 7

    Cell A4
    - Format: Date (3-14-2012 from Date format Type list)
    - Formula: =DATE(YEAR(A3),MONTH(A3),DAY(A3)+$K$1)
    - Resultant value: #VALUE!

    Investigation
    I'm on Office2016 64-bit on a WINDOWS7 64-bit, i7 CPU/16GB RAM

    If I go to Cell A3 and "drag down" to A4 the date increments to 1/10/2018 so it seems as though it is recognized as a date...

    Looking at the Function bar dialog box when you click on "fx" it shows:

    /snip

    DATE
    Year: YEAR(A3) = #VALUE!
    Month: MONTH(A3) = #VALUE!
    Day: DAY(A3)+$K$1 = #VALUE!

    Formula result =

    /snip

    I then look at "Evaluate formula" and get (CY2017 is the tab name):

    /snip

    Reference Evaluation
    'CY2017'!$A$4 = DATE(YEAR("1-10-2017"),MONTH(A3),DAY(A3)+$K$1)

    The next evaluation will result in an error.

    /snip

    No change if I modify Date "type" format or change "/" to "-"...

    Questions
    Why would the date not format to 1-10-2016 per the selected Date format?
    - I went to a blank cell and modified the cell format to the same as above, when I then enter 1/10/17 it changes to 2001-10-17... huh??

    Appreciate any insight, thanks.

    --
    Dave

    • OK, all I can say is WOW... :) I got this to work but it seems to me to have been MUCH more complicated than need be...

      Additional/changed config (from previous post)
      Cell J1
      - Format: Date (*2012-03-14)
      - Current value: 2017-01-10

      Cell A3
      - Format: Date (3-14-2012)
      - Formula: =DATE(YEAR(J1),MONTH(J1),DAY(J1)+0)
      - Resultant value: 1-10-2017

      Cell A4
      - Format: Date (3-14-2012)
      - Formula: =DATE(YEAR(A3),MONTH(A3,DAY(A3)+$K$1)
      - Resultant value: 1-17-2017

      I then drag A4 down to fill out the rest of the year and it works.

      Really feels like this was way more complicated than need be, thoughts?

      --
      Dave

  6. HI,,,
    Hope you doing well in the best of health. I really like the page, which is much helpfull. I need help please guide me.
    I am doing job at college and we deal majority student matters.
    if a student deposit his/her fee after due date, and due date is e.g 25-09-2016 and deposit date is 27-10-2016. each day after due date will b charge as fine Rs. 100. how i will do it with formula........please help

    • Hi Naveed,

      Assuming the due date is in A2, and the actual payment date in B2, and the fine is 100 per day, you can calculate the fine amount with this formula:

      =IF(B2>A2, (B2-A2)*100, 0)

      If necessary, you can add the fine to the original amount, which is, say, in cell C2:

      =IF(B2>A2, (B2-A2)*100+C2, C2)

  7. I have a date derived (via formula) in a cell say A2 and I want to have a new date in cell B2 by adding 2 to Cell A2.

    best part.. In one excel sheet I am able to derive it, but on another sheet I am not :(

    Not sure whats the issue. Please help.

    Thanks,
    Manish

  8. how to do formula to deduct

    A.) (7 yrs, 7 months) - (6 yrs, 5 months) = Answer (formula??)
    B.) (8 yrs, 2 months) - (9 yrs, 1 months) = Answer (formula??)

    formula for

    A.) the difference between three nos.

    compare 1st assessment to 2nd assessment
    compare 2nd assessment to 3rd assessment

    example.

    1st assessment result is 20
    2nd assessment result is 18
    3rd assessment result is 25

    many thanks in advance for your help!!!

  9. i m using a formula in excel =IF(DATEDIF(E7,H7,"D")>0,DATEDIF(E7,H7,"D"),"expired")

    in this i want to add +1 to day in DATEDIF(E7,H7,"D") (i.e) i want the day next to the calculated date . it is possible? if so how , thanks in advance

  10. I need to get the date difference in the this format (years, months and days). Can anyone help me??

  11. How can i subtract 2 Y 11 M 12 D from 39 y 1 M 30 D

  12. well explained indeed.
    Thanks a lot

  13. I'm attempting to create a conditional format that will cause a cell that has a future date in it, to be flagged yellow when that date is 90 days away.

  14. Hello,

    I am trying to subtract date/time but not getting accurate result. Please help me with it.

    7/15/2016 10:30
    7/16/2016 14:00

    How to find the result from above given date/time?

    Thanks,
    Ravi

  15. Supposing I have a ranges of cells comprising of due dates that fall on weekends, holidays and weekdays. Whenever a due dates fall on holidays or weekends, transactions would commence on the next following working day. I used IF, OR, WORKDAY, and WEEKDAY functions but i found it very difficult to suppress due date that falls on weekdays (not a holiday) from incrementing by one(1)day. I am formulating a formula that would address all of the records at the same time. Hoping for your assistance.

  16. I got a date 12 Feb in Excel column and I want to add the year so it can be 12/02/2016 ?

  17. Hi there...Hope you can help me with the following.

    I want to add a date to a cell. Then in a different cell i want it to work out 6 months from the date in the first cell. IF the date then goes pass our current date, i want it to show red or say expired.

    • Hi Lorien,

      Supposing you add the first date to A1. Then you can enter the following formula, say in B1, to add 6 months to the first date:
      =EOMONTH(A1, 6)

      And then, you can create a conditional formatting rule with the below formula to highlight the date in B1 with the red color when it goes past the current date:
      =$B1<TODAY()

      For the detailed instructions, please see How to conditionally format dates and time in Excel.

  18. hi please help me, i used =IF(AG2<(TODAY()+2),"DELIVERY DATE",IF(AG2<(TODAY()-1),"DONE","ON GOING")) formula but the result "done" doesn,t work.

    if AG3 is 2 days before delivery date the result is "delivery date" if after delivery date the result is "done" when AG3 has no date the result is "no supplier delivery date" otherwise "on going"

  19. I am trying to subtract two dates to get a calculated time between the dates in MM:dd:hh:mm format to see how long it takes to resolve an ticket. Example:

    Start Date: 05/01/2016 13:24
    End Date: 05/17/2016 18:04

    Should end up with 00:16:04:40, but it comes out as 01:16:04:40, and I can't for the life of me figure out how to make that month be 00 and be more accurate.

    I have found several articles that use the ability to manipulate the month itself, but doesn't describe how to subtract two dates AND round down on the month to show the accurate time between the two dates. Any help here would save what hair I have left. Thanks.

    • Hi Sandy,

      You can use DATEDIF to get the number of complete months between 2 dates, and then concatenate the results of several functions in 1 formula:

      =DATEDIF(A1,A2,"m") & ":" & DATEDIF(A1,A2,"d") & ":" & TEXT(TIME(HOUR(A2), MINUTE(A2), SECOND(A2)) - TIME(HOUR(A1), MINUTE(A1), SECOND(A1)), "hh:mm")

      Where A1 is the start date, and A2 is the end date.

      The drawback of this approach is that the result is a text string and you won't be able to use it in other calculations.

      • Yes that's the problem. I do need to be able to add the results of this together to get a total time spent on a ticket. Any other ideas?

        • Sorry, I have no other idea. To my best knowledge, none of the Excel functions or formats can display a zero month or day.

          As a workaround, you can use 1 column to present the time difference in an easy-to-understand way (DATEDIF formula). And in another column, calculate the time difference with a simple formula like =A2-A1, and display it in hours and minutes [hh]:mm. And then, use that second column to get the total time.

  20. Hi! Is it possible to do math with dates which are formatted 3.4.2016? So separated with dots in other words.

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