Excel Calculate Date Difference

There are two ways to “excel calculate date difference”: the quick way you copy and the durable way you understand. This page gives you both. The exact Excel answer is above with a tool to test it; below, we build the small mental model that makes the fix stick, so the next variation of the same problem solves itself.

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

Need it as an auditable file?

Ships inside the linked template — formula-driven, unlocked, audit-ready.

View template

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. Treat “excel calculate date difference” as a small repeatable workflow rather than a one-off click you hope to remember next time. Use a small test block before the live file, so any surprise in the affected cells shows up while it is still harmless. 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. That turns a calculation you can defend to a CFO or an auditor into a method you can reuse, explain, and defend when the workbook leaves your screen.

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

Everything above works in Google Sheets too. Excel and Sheets share the formula syntax used here; only the surrounding menus are arranged differently. That portability is deliberate — learn it once and it follows you between the two tools and across Windows and Mac. Nothing on this page is behind a login: the tool runs entirely in your browser, the formula is shown in full with one-click copy, and the steps work the same on Windows and Mac. That is the whole promise here — the exact answer, a way to prove it on your own numbers, and just enough context to make it stick. Here is the takeaway for “excel calculate date difference”: copy the answer if you are busy, but if you have a spare few minutes, rebuild the example in Excel yourself with the tool above open beside it. That single pass — type it, run it, watch the result move when you change an input — is what turns a formula you found into a technique you trust. Keep your inputs labelled and referenced, never hard-coded, and the same sheet stays correct and auditable as it grows. Done that way, you will not need to look this up again, and you will be the person others ask.

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

This is also commonly searched as “how to calculate date difference in excel”, “calculate difference in dates excel”, “how to calculate difference in dates in excel” and “calculate the date difference in excel”. They describe the identical operation, so you are in the right place no matter how you phrased it.

This guide also answers

  • how to compute date difference in excel

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

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