DATEDIF Function in Excel

Intermediate

Calculates the number of days, months, or years between two dates.

Syntax

=DATEDIF(start_date, end_date, unit)

Example

Use Case

Calculate age from date of birth.

Common Errors to Avoid

  • Returns #NUM! if start_date > end_date
  • Unit must be in quotes: "Y", "M", "D", "MD", "YM", or "YD"
  • Not documented in Excel help - legacy function from Lotus 1-2-3

Pro Tips

Use "Y" for complete years, "M" for complete months. Combine units for precise age: =DATEDIF(B2,TODAY(),"Y")&" years, "&DATEDIF(B2,TODAY(),"YM")&" months". Ensure dates are valid Excel date serial numbers.

Need help with this formula?

Our AI Formula Generator can write this for you instantly.

Try AI Formula Generator →
DATEDIF Function in Excel | Excel AI Tools