How to Count Years Between Two Dates in Excel (Formula)

Last Updated: November 21, 2023
puneet-gogia-excel-champs

- Written by Puneet

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.

years-between-two-dates

Use the following steps to write a formula for this:

  1. In cell C1, enter “=DATEDIF(” to start the function.
  2. Refer to cell A1, where you have the starting date.
  3. Now, enter a comma and refer to cell B1 where you have the ending date.
  4. After that, type a comma and enter “y”.
  5. In the end, enter a closing parenthesis and hit enter.
formula-to-get-years

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)"
formula-to-get-years-and-months

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.

Get the Excel File

Download