Excel & Google Sheets Function
DATEDIF function in Excel (with interactive examples)
DATEDIF computes the exact number of complete days ("D"), months ("M"), or years ("Y") between two dates — popular for tenure and age calculations.
Syntax
=DATEDIF(start_date, end_date, unit)Live Interactive Exercise — Try it nowNo login required
Interactive practice grid (DATEDIF reference)
Try our live spreadsheet engine: total Q1 sales in cell B5 using =SUM(B2:B4).
B5fx
| A | B | |
|---|---|---|
| 1 | Month | Sales |
| 2 | Jan | $1,100.00 |
| 3 | Feb | $1,350.00 |
| 4 | Mar | $1,550.00 |
| 5 | Total | type here |
Insert:
Arguments explained
| start_date | Required | Earlier date. |
| end_date | Required | Later date. |
| unit | Required | "D" (days), "M" (months), or "Y" (years). |
Common errors & fixes
#NUM!: Make sure start_date is earlier than or equal to end_date.
Excel vs Google Sheets
Fully documented and supported in Google Sheets.
Practise DATEDIF in a full 4-minute lesson
Every lesson is free to study — build real speed with instant feedback.
Free 1-Page Excel, Google Sheets & SQL Interview Cheat Sheet
The 25 formulas, keyboard shortcuts, and SQL patterns tested most in analyst interviews — emailed instantly, zero spam.