FormulaCamp
Completed
← Google Sheets functions
Google Sheets function

DATEDIF in Google Sheets

DATEDIF is documented in Google Sheets and appears in its function help, unlike Excel where it is a hidden legacy function.

Syntax (same in Google Sheets)

DATEDIF(start_date, end_date, unit)

The units "Y", "M", "D", "MD", "YM" and "YD" are available.

For a fuller explanation of the arguments and common errors, see the DATEDIF Excel guide.

Worked examples in Google Sheets

Complete years

AB
1StartEnd
21/15/20203/20/2024

Formula: D2: =DATEDIF(A2,B2,"y")

Result: 4

From Jan 15, 2020 to Mar 20, 2024 is four complete years.

Months left over

AB
1StartEnd
21/15/20203/20/2024

Formula: D2: =DATEDIF(A2,B2,"ym")

Result: 2

"ym" ignores years and counts the whole months after the last anniversary.

Readable duration

AB
1StartEnd
21/15/20203/20/2024

Formula: D2: =DATEDIF(A2,B2,"y")&" years, "&DATEDIF(A2,B2,"ym")&" months"

Result: 4 years, 2 months

Joins two DATEDIFs into one label.

Try it

A tiny spreadsheet with example data. Edit the formula or any number and see the result.

Formula in F2: =DATEDIF(A2,B2,"m")

Example spreadsheet for DATEDIF
ABCDEF
1StartEndHolidayTimeResult
23/15/20266/20/20265/1/202614:453
31/31/20262/28/20265/9/202609:30
412/24/20251/9/2026
Result in F2: 3
Practice this in a lesson: Tenure, Deadlines, Weekdays

Frequently asked questions

Is DATEDIF a supported function in Google Sheets?
Yes, it is a listed function with its own help page, so it autocompletes and explains its units as you type.

Google Sheets is used here only as a descriptive product name. FormulaCamp is not affiliated with Google.