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.
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:
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)
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:
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:
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 :)
Here are a few formula examples:
=A2-10
=DATE(2015, 5, 6)-10
=TODAY()-10
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:
For example, you add 3 weeks to the date in A2, use the following formula: =A2+3*7
.
Subtracting weeks from date in Excel:
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))
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:
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:
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:
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:
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:
To subtract years, months, 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)
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:
To subtract time in Excel:
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)
If the original cells contain both date and time, the above formula works perfectly too:
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:
- Select the cell in which you want to insert the formula.
- Head to the Ablebits Tools tab, and click the Date & Time Wizard button:
- 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:
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:
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:
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:
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
I have calculated difference between two dates using datedif formula
but Iam having problem calculating difference from the result that i got from above formula like eg. (dd/mm/yyyy)
Start date = 20/04/1983 End date = 31/03/2017
the result i got is 33year, 11months, 11days. Now I want to substract 49 days from the result which Iam not able to do it. Please help me solve the calculation.
Hello,
Please try the following formula:
=DATEDIF("20/04/1983",("31/03/2017"-49),"Y") & "years, " & DATEDIF("20/04/1983",("31/03/2017"-49),"YM") & "months, " & DATEDIF("20/04/1983",("31/03/2017"-49),"MD") & "days"
Hope it will help you.
I want to generate weekly report on sunday or on Monday, but data will be taken upto every Saturday, how can I use formula to calculate the values based on selected dates, e.g I have data from 1-aug-17 to 21-Oct-17, I want to calculate the values between these dates, but in next week how I can calculate it, as the date will be changed to 28-Oct-17 and so on....
Very helpful. I used the subtract dates instructions for the simple task of calculating a series of due dates based on an upcoming meeting date. I didn't realize it was so simple, but I would not have thought of trying it without your instructions. Thanks!
I'm having trouble listing dates via function.
what i'm trying to get is:
A1= Current Date in YY Mmm format {=TEXT(TODAY(),"YY Mmm")} lets say it reads: "17 Oct"
A2= One month later: "17 Nov"
A3= One Month after that: "17 Dec"
and here is where things get to be an issue A4= One more month: "18 Jan"
Which is how it should read, but the next one, A5, reads "17 Feb" when it should read "18 Feb"
and then it should continue from there, updating the year as each January passes. And every time the current month changes, the months along the entire A column would reflect that.
I am looking to show only the last 4 weeks of play for each player with a rolling total. I have tried a number of formulas and I am still having problems: (SUMIF and how to subtract weeks).
The Total of 149 is for 5 weeks. 20 June 17 and 21 should be hiding or disappear and be replace by 27 June 17and 33 and so on. The total should read 128.
W1 W2 W3 W4 W5 Tot
20-Jun-17 27-Jun-17 04-Jul-17 11-Jul-17 18-Jul-17
21 33 33 30 32 149
Thanks for your guidance. Using Excel 2007.
How to add 3years 4 months 5 days to 2years 4 months 5 days
To find out total experience
Hi ,
The tab is called Open Issue -It has a reported date column ,
I have a status column and
What I need is the status column should display 'Less than 30day open' , 'between 30 to 60days' 'open and more than 90 days'.
I was able to get =TODAY()-A5 = to get the number days open but not sure how to move forward from there
Hi
I enter multiple dates in Single Column and Deduct from Today's Date
Rcpt Date
25.7.17
27.7.17
Today's Date
Now I want to Deduct today()-27.07.17
Is it Possible
GREAT sharing. thanks so much
I have a column formatted as date YYYY-MM-DD, and I am using your formula to add 50 to the year.
I used
=DATE(YEAR(E2)+50,MONTH(E2),DAY(E2))
I thought this would be simple, but I am getting a Value error. I am obviously missing something simple, but I am having one of those days
Any help would be appreciated. Thanks
I discovered the problem, Excel thinks the world started after 1900. My dates were 1800s and Excel does not recognize anything before 1900 as a date.
How would I go about adding 90 days to a date. I am looking to add 90 days from one column to another.
difference bitwen two dates one day is left plz solve this prob
Hey!
I'm trying to use dates for my study spreadsheet, and I have the end of semester date - Todays date which gives me my total days left. This is great, except I now want to subtract every thurs and fri (for work) from that! And I want this to constantly self update, so that when I pass those days, that subtraction is no longer reflected in the total. I also then want to subtract a specific two weeks (date to date)also for a trip in between.
Please help :)
Trying to estimate approximate production dates from the following data:
1st Unit, serial 1701, produced on 01/July/1931
165th Unit, serial 1866, produced on 01/July/1935
Average .793 unit made per week
How can I calculate the rough production date in DD/MM/YYYY format for each of the 165 units?
Formula to be copied/pasted in existing excel sheet.
Thanks in advance!!!
Patrick
how to add dates on excel?. I created a table containing data of daily sales with a date above on it but i can't filter each date since it never appears in filter
Hi I am trying to calculate the difference between two numbers represented as years and months. ie What is the difference between 7 years and 2 months and 5 years and 10 months?
hELLO,
How to calculate the how many days left?
If my campaign start Date 4/29/2017 and ends at 11/14/2017.
How can i calculate that how many days left to ends this campaign?
where Strat Date on cell B2 and Ends Date At cell D2 i have to calculate E2
I NEED TO SHOW CORRECT MONTHS TO DETERMINE TAX EG. START DATE 1/APR/17 END DATE IS 31/MAR/18, IF I HAVE A DATE 4/June/18 or 5/Nov/18 how can i have to arrive at 12 months from start date. what formula I have to use to get correct months.
i have calculated the experience of employees like form 1/1/1998 to 25/9/2000
answer is 2 years, 0 months, 24 days and second form 1/11/2000 to 31-12-2002 answer is 2 years, 0 months, 30 days and third form 5/4/2003 to 08-01-2007 answer is 3 years, 0 months, 04 days now i want to calculate the three answers in a manner to 07 years, 01 month, 28 days.
How could i am able to calculate it with the help of formula
thanks
Best Regards
Shahid Zaheer Meo
Thank you for a very interesting article and website.
If I put 3/31/2017 in A1, the formula =DATE(YEAR(A1),MONTH(A1)+1,DAY(A1))in B1, and the formula =EDATE(A1,1)in C1, I get 5/1/2017 for B1 and 4/30/2017 for C1.
I was expecting the same result for each formula.
Why is there a difference when both formulas are supposed to yield the same, namely one month from 3/31/2017?
What am I missing?
Hi, James,
it is a very interesting notice! DATE and EDATE functions treat the months in slightly different ways. EDATE adjusts the results by adding a whole month (but since April consists of 30 days, its last day is shown). DATE, in its turn, adds the same number of days, but the 31st day is treated by the function as the 1st day of the next month. Please, look at the example below to get a clear understanding.