ExcelTool.io

DATEDIF

Returns the difference between two dates in complete years, months, or days.

Syntax

=DATEDIF(start_date, end_date, unit)

Arguments

  • start_date - The earlier date.
  • end_date - The later date.
  • unit - "Y" years, "M" months, "D" days, and "YM"/"MD"/"YD" for remainders.

Examples

=DATEDIF(A2, B2, "Y")

Returns: Whole years between the dates

Common for age or tenure.

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

Returns: Days from A2 until today

Pair with TODAY() for a live counter.

Common Errors and Gotchas

  • DATEDIF returns #NUM! if start_date is later than end_date.
  • It's a legacy function with no autocomplete - type it in full. It works but is undocumented in modern Excel.

Does DATEDIF Work in Google Sheets?

Google Sheets supports DATEDIF with the same arguments.

Build a DATEDIF formula

Fill in your ranges and copy a ready-to-paste formula - no signup.

Date Difference Generator

See Also