DATEDIF measures the gap between two dates in six units — Y/M/D for totals and YM/MD/YD for the remainder ignoring larger units. It is the hidden age/tenure function. This page measures all six units and the reversed-date trap live.
Returns the complete-unit difference. start must be ≤ end or it raises #NUM!; units are case-sensitive in this engine.
DATEDIF measures the gap between two dates in six units — Y/M/D for totals, YM/MD/YD for the remainder ignoring larger units. It is the hidden age/tenure function. Every row measured live. Click any row to load it.
| Expression | Result | Why |
|---|---|---|
| =DATEDIF(DATE(2020,3,15),DATE(2024,7,20),"Y") | 4 | Complete years |
| =DATEDIF(DATE(2020,3,15),DATE(2024,7,20),"M") | 52 | Complete months |
| =DATEDIF(DATE(2020,3,15),DATE(2024,7,20),"D") | 1588 | Total days |
| =DATEDIF(DATE(2020,3,15),DATE(2024,7,20),"YM") | 4 | Months ignoring years |
| =DATEDIF(DATE(2020,3,15),DATE(2024,7,20),"MD") | 5 | Days ignoring months/years |
| =DATEDIF(DATE(2020,3,15),DATE(2024,7,20),"YD") | 127 | Days ignoring years |
| =DATEDIF(DATE(2024,7,20),DATE(2020,3,15),"D") | #NUM! | Reversed dates raise #NUM! |
| =DATEDIF(DATE(2024,1,15),DATE(2024,12,31),"M") | 11 | Complete months within a year |
| Expression | Result | Why |
|---|---|---|
| =DATEDIF(DATE(2020,3,15),DATE(2024,7,20),"Y") | 4 | years |
| =DATEDIF(DATE(2020,3,15),DATE(2024,7,20),"YM") | 4 | remaining months |
| =DATEDIF(DATE(2020,3,15),DATE(2024,7,20),"MD") | 5 | remaining days |
Edit the table or type any formula — the engine evaluates instantly. Load a preset to see DATEDIF return complete years, months, days, and the YM/MD/YD remainders for an age string.
8 failure patterns mined from actual user reports on Reddit, Stack Overflow and Super User — each with the authentic symptom, root cause, a fix, and a runnable formula. Not textbook theory.
DATEDIF works in Excel and Google Sheets as a legacy compatibility function. Unit case-sensitivity differs by engine — this page uses uppercase units, which are safest across platforms.
| Platform | Support | Notes | Gotcha |
|---|
DATEDIF is one piece. The full course walks the toolkit end to end with live, measured examples.