Date Difference Excel

This guide treats “date difference excel” the way busy spreadsheet users actually want it: answer first, a live tool to prove it on your own data, then the reasoning. It is written for Excel but calls out every place Google Sheets differs, and the platform toggle at the top switches all shortcuts between Windows and Mac so nothing here assumes the keyboard you are not on.

Exact answer

In Excel: use =DATEDIF(start_date, end_date, "d") — it returns the difference between two dates in the unit you ask for: "d" for days, "m" for whole months or "y" for whole years.

Syntax

=DATEDIF(start_date, end_date, unit)

Arguments

ArgumentDescription
start_daterequiredThe earlier date — the start of the period.
end_daterequiredThe later date — the end of the period; it must not be earlier than start_date.
unitrequiredThe unit in quotes: "d" days, "m" whole months, "y" whole years, plus "ym", "yd" and "md" for the leftover part.

Related functions

NETWORKDAYSWEEKDAY
ƒxDate Difference CalculatorLive
Days between
364

Breakdown: 0 years · 11 months · 30 days

Workdays (Mon–Fri, NETWORKDAYS)
261
=B2A2 · =NETWORKDAYS(A2,B2)
Ctrl+CthenCtrl+Shift+V+Cthen+Ctrl+VPaste values · WindowsMac

What this does

DATEDIF returns the gap between two dates measured in whole days, months or years, depending on a unit code you give in quotes. Beyond the basic "d", "m" and "y", three combination codes return only the remainder: "ym" the months ignoring whole years, "yd" the days ignoring whole years, and "md" the days ignoring whole months. It is most famous for age calculation — =DATEDIF(DOB, TODAY(), "y") gives a person's age in completed years. DATEDIF is an UNDOCUMENTED legacy function: it does not appear in Excel's function list and gives no autocomplete, but it works in every version. Notably the unit codes stay as the English letters "y", "m" and "d" even in German Excel. The same idea underpins a lot of everyday Excel work, so the few minutes spent getting it right here pay back across every sheet you build afterwards. Treat it as a pattern, not a one-off, and it stops being something you look up and starts being something you reach for. The difference between a quick fix and a sheet you can trust is the extra minute you spend validating “date difference excel”. Start on a copy or a tiny sample, keep the affected cells visible, and compare the result with the tool above before you touch the real workbook. When a formula is involved, keep the inputs labelled beside it, reference cells instead of typing values, and apply number formatting only after the result checks out. The point is a workflow that saves repeating the same clicks every week, but the practical win is that someone else can open the file and understand what happened without asking you.

A worked example

A start date 15/03/2020 sits in A2 and an end date 03/06/2026 in B2. =DATEDIF(A2, B2, "y") returns 6 (whole years), =DATEDIF(A2, B2, "m") returns 74 (whole months), and =DATEDIF(A2, B2, "d") returns 2271 (days). For an exact age string, combine units: =DATEDIF(A2, B2, "y") & " years, " & DATEDIF(A2, B2, "ym") & " months" returns "6 years, 2 months". For a live age, use TODAY() as the end date. DATEDIF is the simplest way to get a clean whole-number difference in years, months or days — the standard tool for ages, tenure and durations across every Excel version. One habit worth forming early: name the cells that hold your inputs, so the formula reads in plain language instead of a string of cell addresses. A reviewer — or you in three months — can then follow the logic without decoding what B7 and D2 were supposed to mean, which is most of what makes a sheet maintainable.

In Google Sheets

If you are in Google Sheets rather than Excel, the good news is that the formula shown here is identical and the workflow barely changes — menus sit across the top instead of in a ribbon, and a few function names differ slightly, but anything you build here moves across with little or no rework. Keep this page bookmarked for the next time the same question comes up. Better still, rebuild the example once in your own sheet — doing it yourself, with the tool above to check against, is what turns a copied formula into a technique you own. Treat “date difference excel” as a small building block rather than a chore. Once the inputs sit in their own cells and the formula reads from them, the same setup answers a dozen related questions with a tweak, and Excel keeps every dependent figure current as the data changes. The tool above is there so you can rehearse and verify before committing anything to a real workbook; the steps and worked example are there so the logic sticks. Get it right once and it stops costing you time — it starts saving it, every time the question comes back around.

Common mistakes

  • Putting the dates in the wrong order — start_date must be the earlier date, or DATEDIF returns a #NUM! error.
  • Expecting "d" to count only working days — DATEDIF counts every calendar day; for weekdays use NETWORKDAYS instead.
  • Translating the unit codes in German Excel — they stay as the English letters "y", "m" and "d"; only the argument separator changes to a semicolon.

Frequently asked questions

Why is DATEDIF not in the function list?

DATEDIF is an undocumented legacy function kept for Lotus 1-2-3 compatibility, so Excel offers no autocomplete or wizard for it. You must type it in full, but it calculates correctly in every version.

How do I calculate age with DATEDIF?

Use the "y" unit with TODAY() as the end date: =DATEDIF(DOB, TODAY(), "y") returns the age in completed years. Add "ym" and "md" parts if you want years, months and days.

Do the unit codes change in German Excel?

No. The unit codes stay as the English letters "y", "m" and "d" even in a German installation; the function name also stays DATEDIF, and only the argument separator becomes a semicolon: =DATEDIF(A2; B2; "y").

Other ways people ask this

On the way here you may have searched this as “difference of dates in excel”, “excel difference dates”, “excel formula date difference” and “excel formula for date difference” — it is all the same task, and this page is the single, complete answer to it.

Why do people search for this in so many different ways?

Because the same task has many names. “difference of dates in excel”, “excel difference dates”, “excel formula date difference” all point at the one operation explained on this page, which is why they all lead here.