Complete years
| A | B | |
|---|---|---|
| 1 | Start | End |
| 2 | 1/15/2020 | 3/20/2024 |
Formula: D2: =DATEDIF(A2,B2,"y")
Result: 4
From Jan 15, 2020 to Mar 20, 2024 is four complete years.
DATEDIF is documented in Google Sheets and appears in its function help, unlike Excel where it is a hidden legacy function.
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.
| A | B | |
|---|---|---|
| 1 | Start | End |
| 2 | 1/15/2020 | 3/20/2024 |
Formula: D2: =DATEDIF(A2,B2,"y")
Result: 4
From Jan 15, 2020 to Mar 20, 2024 is four complete years.
| A | B | |
|---|---|---|
| 1 | Start | End |
| 2 | 1/15/2020 | 3/20/2024 |
Formula: D2: =DATEDIF(A2,B2,"ym")
Result: 2
"ym" ignores years and counts the whole months after the last anniversary.
| A | B | |
|---|---|---|
| 1 | Start | End |
| 2 | 1/15/2020 | 3/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.
A tiny spreadsheet with example data. Edit the formula or any number and see the result.
Formula in F2: =DATEDIF(A2,B2,"m")
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | Start | End | Holiday | Time | Result | |
| 2 | 3/15/2026 | 6/20/2026 | 5/1/2026 | 14:45 | 3 | |
| 3 | 1/31/2026 | 2/28/2026 | 5/9/2026 | 09:30 | ||
| 4 | 12/24/2025 | 1/9/2026 |
Google Sheets is used here only as a descriptive product name. FormulaCamp is not affiliated with Google.
Enter — commit · F2 — edit · F4 — $ in a reference · Ctrl+C/Ctrl+V — copy and paste · Ctrl+Z — undo
Esc or F6 — leave the sheet for the «Check» button · Shift+Tab in the first cell — back to the page