Date & Time All versions ◉ 2 views

=DATEDIF()

Calculates the difference between two dates in years, months, or days

=DATEDIF(start_date, end_date, unit)
Hover argument names in the table for details.
Output typeNumber
Popularity70 / 100
VolatileNo
Dynamic ArrayNo
📥 Download sample .xlsx — Coming soon ▦ Try in Playground Dedicated file for this function — safe & lightweight · sample data + live formulas
Share:

⬇ Download Sample Workbook

A dedicated .xlsx for =DATEDIF() with Persian sample data & live formulas — open in Excel and practice.

  • Sheet “Sample” — data table + formula in place
  • Sheet “Guide” — syntax, arguments & tips from this page
  • Instant & secure (token + rate limit)
📥 Download DATEDIF.xlsx — Coming soon ~ 8–12 KB · No macros

⇪ Share

Send this function to friends

🧠 🧠 Quiz this function

%d questions — syntax, example & errors — test yourself!

◧ Arguments

ArgumentTypeRequiredDescription
start_date Date Required Start date
end_date Date Required End date
unit Text Required Unit of the difference calculation

▣ Examples

Example 1 =DATEDIF(A2, TODAY(), "Y")
Example 2 =DATEDIF(A2, B2, "M")

✦ Tips

  • The start date must be before the end date.
  • The unit must be enclosed in quotes.
  • To express a length of service as "years and months", use the "Y" and "YM" units together.
  • The "MD" unit gives wrong results for some dates and is better avoided.

⚠ Common Errors

#NUM! The start date is after the end date, or the unit is misspelled
Fix: Swap the two dates and check the unit

💬 Comments & Q&A 0 approved

🔒 Your comment will be published after review.

Share your thoughts — visible after admin approval

No comments yet — be the first!

✍️ Add comment / question

captcha
🔒 Your comment will be published after review.