SpreadsheetWeb blog

How to count years between two dates with the DATEDIF

This article show you how to get years between two dates and meets you with a hidden gem in Excel, the DATEDIF function.

How to count years between two dates with the DATEDIF

This article show you how to count years between two dates using the DATEDIF function.

How to count years between two dates with the DATEDIF

Syntax

=DATEDIF(start date, end date, "y")

Steps

  1. Use =DATEDIF(
  2. Select or type range reference that includes start date B3,
  3. Select or type range reference that includes end date C3,
  4. Type "y" to specify year
  5. Type ) and press Enter to complete the formula

How

DATEDIF is a rarely used function known by few users. Microsoft hasn't documented it since Excel 2000 and actually wants it to be forgotten. The DATEDIF function has been derived from Lotus 1-2-3 for compatibility and luckily still there to help us.

The DATEDIF function returns the difference between two dates by specified unit type. It gets 3 arguments, start date, end date and unit. The unit is a string that specifies the difference type that may be day, month, year or combination of them. For example; "y" string represents year and this is what we need for this article.

=DATEDIF(B3,C3,"y")

Also see article how to count months between two dates with the DATEDIF.