FP

FormulaPilot

Spreadsheet formula tools

Open generator
Function reference

DATEDIF in Excel & Google Sheets

DATEDIF is used in 1 formula pattern in this library. Browse worked examples below, or use the generator to build a custom variation for your specific data.

When to use DATEDIF

  • Compute employee tenure, customer age, asset age, or any interval measured in full years.

Worked examples (1)

Common errors with DATEDIF

DATEDIF is undocumented

DATEDIF is intentionally hidden from Excel's function list but still works. Type it manually — Excel will not autocomplete it.

Returns 0 for dates less than a year apart

DATEDIF returns complete units only. If the range is less than 12 months, "Y" returns 0. Use "M" for months or "D" for days if you need finer granularity.

Frequently asked questions

How do I also show the remaining months after the full years?

Add a second DATEDIF with the "YM" unit — =DATEDIF(A2,TODAY(),"Y")&" years, "&DATEDIF(A2,TODAY(),"YM")&" months".

Need a custom variation?

Describe your specific DATEDIF problem and get a formula written for your exact data.

Open generator with DATEDIF