In Excel, you can use the DATEDIF function to count the number of years that you have between two dates. And in this tutorial, we are going to learn how to get that count.
Years Between Two Dates
In the following example, you have a start date and an end date. Now in cell C1, we are going to use the DATEDIF function to get the years between these two dates.
Use the following steps to write a formula for this:
- In cell C1, enter “=DATEDIF(” to start the function.
- Refer to cell A1, where you have the starting date.
- Now, enter a comma and refer to cell B1 where you have the ending date.
- After that, type a comma and enter “y”.
- In the end, enter a closing parenthesis and hit enter.
In the above snapshot, you can see that we have 8 in the result, which is the number of completed years between the dates you have specified.
=DATEDIF(A1,B1,"y")
But if you want to get the complete picture of the years between these two dates you can use the following formula.
=DATEDIF(A1,B1,"y")&" Year(s), "& DATEDIF(A1,B1,"ym")& "month(s)"
The first part of this formula gets the complete number of years, and the second part gets the count of months from the incomplete year left behind.