FormulaCraft

DATEDIF vs YEARFRAC: measuring durations in Excel and Sheets

Topic:Date arithmetic
Excel & Google Sheets
=DATEDIF(A2,B2,"Y")

Try it with your data

Edit the grid or formula, then run it through a real spreadsheet engine — no signup.

Sample data — click any cell to edit

Runs server-side · free · no signup

Step by step

  1. 1DATEDIF(start, end, "Y") returns whole completed years — ideal for age and tenure.
  2. 2YEARFRAC(start, end) returns a fraction, e.g. 2.5 years, for financial proration.
  3. 3Use DATEDIF for human-readable counts and YEARFRAC where partial periods matter.

Tips

Need it for your exact data?

Describe your columns in plain English and get the precise formula for your sheet, with the right Excel or Sheets syntax.

Frequently asked

Why is DATEDIF missing from the function list?

DATEDIF is undocumented but works in Excel and Google Sheets for backward compatibility. Type it manually — autocomplete may not suggest it.

More on Date arithmetic

See all →

Formulas used

Written and reviewed by FormulaCraft Team. Each formula on this page is run through our verification engine before publishing.

Last reviewed: