# How to Subtract Years in Excel

How to subtract or add years to date in Excel 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.

Calculating the difference between two dates is a common task in Excel. By learning how to subtract dates in Excel, you can easily get the number of days, months, and years between two dates. In this tutorial, we’ll show you how to subtract years in Excel using the DatedIF function.

First, open the Excel sheet containing the two dates you want to subtract. In this example, we have Start Date and End Date in columns A and B, respectively.

To get the difference in years between the two dates, we’ll use the DatedIF function. In cell C2, type =DatedIF. Then, open a parenthesis and select cell A2 (Start Date). Add a comma, and select cell B2 (End Date) as the second parameter. Add another comma, and within double quotes, write “Y” to subtract years. Close the parenthesis and press Enter. The result will be the difference between the two dates in years.

To get the difference in months, use the same DatedIF function. Type =DatedIF, open a parenthesis, select the start date (cell A2), add a comma, select the end date (cell B2), add a comma, and within double quotes, write “M” to subtract months. Close the parenthesis and press Enter. The result will be the difference between the two dates in months.

To get the difference in days, again use the DatedIF function. Type =DatedIF, open a parenthesis, select the start date (cell A2), add a comma, select the end date (cell B2), add a comma, and within double quotes, write “D” to subtract days. Close the parenthesis and press Enter. The result will be the difference between the two dates in days.

If you encounter an error when dragging the formula to autofill, it’s likely because the date format doesn’t match that of your computer. Ensure that the date format of the two dates is the same to avoid errors.

In conclusion, the DatedIF function in Excel is a powerful tool that can help you calculate the difference between two dates. By using this function, you can easily subtract years, months, and days in Excel.

## FAQ

How do I subtract years from a date in Excel?
Select cell "B1" and type in the following formula (without quotes): "=DATE(YEAR(A1)-X,MONTH(A1),DAY(A1))". Change "X" to the number of years you want to subtract from the date in "A1."
What is the formula for subtraction dates in Excel?
Select cell D2, which is the first blank cell in the Duration column. Type =C2-B2, and then press RETURN . Excel displays the result as the number of days between the two dates (104).
How do I use the years formula in Excel?
YEAR(serial_number) returns a year corresponding to a given date, as a number from 1900 to 9999. The Excel YEAR function is very straightforward and you will hardly run into any difficulties when using it in your date calculations: =YEAR(A2) - returns the year of a date in cell A2.