Wauvel

Excel like a finance pro.

← The library

Date function

DATEDIF

Returns the complete years, months, or days between two dates; undocumented but reliable.

Very commonDifficulty 1200 · ProficientUsage rank #73 of 520
Practice · 24 questions →

When to use it

The difference between two dates in whole years, months, or days, with units for the leftover parts. Undocumented in Excel's function list but fully supported: it is how you compute exact ages and tenure.

The shape of it

Syntax
=DATEDIF(start_date, end_date, unit)
Example
=DATEDIF(A1,TODAY(),"Y")

Worked examples

  • Age in years

    =DATEDIF(DATE(1990,5,20),DATE(2025,3,15),"y") 34

    Whole years.

  • Leftover months

    =DATEDIF(DATE(1990,5,20),DATE(2025,3,15),"ym") 9

    Months left over after the whole years.

  • Leftover days

    =DATEDIF(DATE(1990,5,20),DATE(2025,3,15),"md") 23

    Days left over after whole months.

Worth knowing

  • Units: "Y", "M", "D", "YM" (months ignoring years), "MD", "YD".
  • Units: "y", "m", "d" for totals; "ym", "md", "yd" for remainders.
  • Readable tenure: =DATEDIF(s,e,"y")&" y "&DATEDIF(s,e,"ym")&" m".
  • The start date must be first; it does not accept negative spans.

Where it goes wrong

  • #NUM! when the start date is after the end date.
  • The "md" unit has known quirks around month ends; test edge cases.
  • No autocomplete because it is undocumented; type it fully.

Related

Learn the moves here — or let Wauvel run them on your numbers.

Meet your AI CFO →

One CFO-grade Excel tip a week

A short, practical email for finance operators — functions, shortcuts, and the moves that save an afternoon. Free, unsubscribe anytime.