What it does
DATEDIF returns the difference between two dates in years, months or days.
Syntax or pattern
=DATEDIF(start_date, end_date, unit)5 practical examples
Calculate age in years
Return whole years between birth date and today.
=DATEDIF(A2,TODAY(),"Y")Common for age calculations.
Months between dates
Count complete months between two dates.
=DATEDIF(A2,B2,"M")Useful for tenure and durations.
Days between dates
Count complete days between two dates.
=DATEDIF(A2,B2,"D")Simple date difference.
Years and months label
Build a readable tenure label.
=DATEDIF(A2,TODAY(),"Y")&" years "&DATEDIF(A2,TODAY(),"YM")&" months"Combines two units.
Project duration
Measure project duration in months.
=DATEDIF(StartDate,EndDate,"M")Good for project summaries.
Common mistakes to avoid
- Check whether dates are real Excel dates, not text.
- Be careful with weekends, holidays and time portions.
- Explain whether a result counts calendar days or workdays.
Related Excel examples
FAQ
Why does the date formula return a number?
Excel stores dates as serial numbers. Format the cell as a date to display it correctly.
Here are some ideas for you
Optional resources that may help if you are learning formulas, building reports, or working in spreadsheets often.
- Excel formula booksSee ideas
Practice formulas with structured examples you can keep beside your desk.
- Excel shortcut guidesSee ideas
Build speed with keyboard shortcuts for selection, formatting and navigation.
- Numeric keypadsSee ideas
Helpful if you enter many numbers on a laptop or compact keyboard.
- External monitorsSee ideas
Useful for viewing large worksheets, formulas and reference tables side by side.
- Desk notebooksSee ideas
Sketch formula logic, report ideas and table structures before building.
- Laptop standsSee ideas
Make long spreadsheet sessions more comfortable and ergonomic.
Some links in this section may be affiliate links. Choose only what is useful for your own work.