Date formula
DATEDIF in Excel and Google Sheets
Calculate the difference between two dates in days, months or years.
Syntax
=DATEDIF(start_date, end_date, unit)- start_date
- The earlier date.
- end_date
- The later date.
- unit
- "d" days, "m" months, "y" years.
Example
| Row | A | B | C |
|---|---|---|---|
| 1 | Start | End | Months |
| 2 | 2026-01-15 | 2026-10-15 |
C2 =DATEDIF(A2,B2,"m")
Result: 9
Counts full months between the dates.
Ready-to-copy formulas
Age in years
=DATEDIF(A2,TODAY(),"y")Days between dates
=B2-A2
Tips
- Start date must be before end date or you get #NUM!.
Need the whole spreadsheet?
Start from a free template with every formula already in place. Opening a template uses no credits.