Excel AI App
Open App

Date Difference Calculator (DATEDIF)

Pick a start and end date to see the difference in years, months, and days — and copy the exact DATEDIF formula to reproduce it in Excel or Google Sheets. DATEDIF is the go-to function for ages, tenures, and durations.

The calculation runs in your browser.

Full difference
6y 4m 12d
Total months
76
Total days
2,325
DATEDIF formula (full breakdown)
=DATEDIF("2020-03-15", "2026-07-27", "Y") & " years, " & DATEDIF("2020-03-15", "2026-07-27", "YM") & " months, " & DATEDIF("2020-03-15", "2026-07-27", "MD") & " days"

DATEDIF units explained

=DATEDIF(start_date, end_date, unit). The unit is a text code: "Y" whole years, "M" whole months, "D" total days.

"YM" gives the leftover months after whole years, "MD" the leftover days after whole months, and "YD" the days ignoring years. Combine "Y", "YM", and "MD" to display a full 'X years, Y months, Z days' age.

Why DATEDIF isn't in the function list

DATEDIF is a legacy function kept for compatibility, so Excel doesn't show it in autocomplete — but it still works if you type it. It also exists in Google Sheets with the same syntax.

Frequently asked questions

How do I calculate age in Excel?

Use =DATEDIF(birthdate, TODAY(), "Y") for whole years. For a precise age, combine units: =DATEDIF(birthdate, TODAY(), "Y") & " years, " & DATEDIF(birthdate, TODAY(), "YM") & " months".

Why does DATEDIF return a #NUM! error?

That usually means the start date is later than the end date. DATEDIF requires start_date ≤ end_date.

Does DATEDIF work in Google Sheets?

Yes, with identical syntax and unit codes.

Keep exploring

Free Tool
IF Formula Builder
Free Tool
SUMIF / COUNTIF Generator
Guide
Write Formulas with AI
Guide
Excel IF Formula Guide

Analyze a whole spreadsheet with AI

Upload an Excel or CSV file and get pivots, outlier detection, and Smart BI dashboards in seconds. Free to start — no credit card.

Open the App Free