Excel Subtract/Add Date Formulas

There is a number of ways for calculating the difference between two dates in Excel. You may get the number of days, months and years by using these ways along with adding or subtracting and getting the resultant dates.

Infographic: Excel Date Calculation - Adding and Subtracting Dates in Excel, by using +/- operators, DATEDIF, SUM and DATE Functions.

  • MS Excel provides a number of ways to calculate the difference between two dates.
  • You may get the number of days, months, and years by using these ways along with adding or subtracting and getting the resultant dates.

First way – Subtract Dates in Excel by (-) operator

This is the simplest way of subtracting two dates and getting the number of days. Simply use the minus “-“ between two dates.

For example, the A2 and B2 cells are given dates. The C2 cell displays the subtracted result of these two dates.

The Formula:

=B2-A2

Excel subtract dates

The difference between 5/30/2016 and 6/6/2016 is 7 days.

Just make sure that the C2 column or cell wherever you are displaying the result after subtraction is using the general format (and not the date format). See the graphic below where you may ensure it:

Excel general

You can see this dropdown under the Home in the ribbon.

Second way: Using the DATE function to subtract Years/Months and Days

In this example, you may enter a date in the D3 cell, and DATE formula will subtract 2 years, minus 2 months, and minus 2 days from that date and display the resultant date in the D4 cell.

First, have a look at the formula and result and I will explain a little:

The formula:

=DATE(YEAR(E3) - 2, MONTH(E3) - 2, DAY(E3) - 2 )

The output as I entered 3 March 2017 (3/3/2017):

Excel subtract real

In the formula, I used YEAR, MONTH, and DAY functions inside the DATE function. The DAY function got the day from the given E2 cell date and subtracted 2.

The MONTH function took March from the given date and subtracted 2 months. Similarly, the YEAR function subtracted 2 years.

In the end, the DATE function combined all three and resulted in 1/1/2015.

Add a date in Excel formula

In the same way, you may add days, numbers, and years to the given date by using this formula:

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

See what that resulted from the same date as I used '+' for addition:

Excel add real

The example of subtracting a given date from today

You may use the TODAY() function to get the difference between the current day and a given day e.g. Date of Birth.

See the following example of subtracting TODAY() by DOB by using “-“:

The date subtract Formula:

=TODAY()-B2

Excel subract days

Also learn: Excel Today's Date by using VBA

Third way: Using DATEDIF function to get the difference in days

You may also use DATEDIF function for the difference between two dates. For that, use the “D” value for the unit in DATEDIF function.

If you have no idea about the DATEDIF function, the following example should make it clear:

DATEDIF formula:

=DATEDIF(A2,B2,"D")

subtract DATEDIF

The DATEDIF function takes two dates. The first date should be less than the second date. The third argument specifies what you require; days, months, or years.

Getting the Month difference example

The following example shows the difference in Months for the two given dates. This is done by using the DATEDIF function with “M” value:

The formula:

=DATEDIF(A4,B4,"M")

subract DATEDIF Months

Make sure to use the respective cells containing dates as you copy this formula.

The example of TODAY() minus DOB for getting age in Years

For this example, the number of years is calculated after subtracting the TODAY()’s date from the DOB column. This is accomplished by using the “Y” unit value in DATEDIF function as follows:

The formula:

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

The output as used with few cells to calculate age in years in Excel:

subtract DATEDIF years

Getting years difference by simply subtracting two dates

You may also get the years difference by using the first way in this tutorial i.e. simply use the subtraction “-“. In that case, two dates are subtracted and the result is divided by 365 or 365.25 (for leap years factor). Have a look at this formula and output:

The formula for years calculation with subtraction:

=(TODAY()-B2)/365.25

The resultant sheet:

subtract years

In the C2 and C3 cells, you may notice the years with decimal points. For getting the rounded years, you may use the ROUND function as used for the C4 cell:

=ROUND((TODAY()-B4)/365.25,0)

Alternatively, you may also use the INT function that I applied in C5 and C6 cells:

=INT((TODAY()-B5)/365.25)

Getting the date difference with Years/Months and Days combined

Until now, we have seen examples of getting the Years, months, and days separately. In situations, you may require all. See the following example where the difference of dates is returned for: Days, months, and years for the DOB:

The formula used in C5 cell:

=DATEDIF(A5,TODAY(),"y") &" Years and "&DATEDIF(A5,TODAY(),"ym") &" Month(s) and " &DATEDIF(A5,TODAY(),"md") &" Days"

The overall output:

subtract years days months

You may learn more about DATEDIF function in its tutorial.