Home/Guides/Years between two dates

Date guide · Reviewed 9 November 2026

How to calculate the years and months between two dates, by hand and in Excel.

Count the complete years first, then the complete months left over, then the remaining days. 15 June 2015 to 2 September 2026 is 11 years, 2 months, 18 days, which is 4,097 days in total. The method takes four steps, and the only places it goes wrong are month-ends and leap days.

LikeOptions Editorial Team
Financial Education Specialists
LikeOptions Editorial Team creates neutral, educational content on financial planning, investing, and options strategies. All content is reviewed for accuracy and clarity.
  • Financial writing
  • Educational content

The four steps

  1. Put the dates in order. The earlier one is the start, the later one the end. The span is the same either way; only the sign changes.
  2. Count complete years. Subtract the years. If the end date falls before the start's month and day in the final year, take one year off, because that last year is not complete yet.
  3. Count complete months. From the date that marks the end of the last whole year, count whole months forward without passing the end date.
  4. Count the leftover days. The days from that last whole-month date to the end date are the remainder.

Worked example: 15 June 2015 to 2 September 2026

The years run from 2015 to 2026, which is 11. 15 June 2015 plus 11 years is 15 June 2026, which is before the end date, so all 11 years are complete. Counting forward from there, 15 June plus 2 months is 15 August, and a third month would reach 15 September, which is past 2 September. So there are 2 complete months. From 15 August to 2 September is 18 days (16 days to reach 31 August, plus 2). The answer is 11 years, 2 months, 18 days.

The same span in other units: 134 complete months, 585 weeks and 2 days, or 4,097 days. As a decimal it is about 11.22 years when you divide the days by 365.2425, the average length of a calendar year, or 11.17 if you divide complete months by 12. The two decimals differ because the second ignores the 18 leftover days.

The borrowing shortcut

Subtracting date parts column by column works like long subtraction: end minus start for years, months and days, borrowing when a column goes negative. Here, 2026 − 2015 gives 11 years, 9 − 6 gives 3 months, and 2 − 15 gives −13 days. A negative day count means borrowing a month: 3 months becomes 2, and the days become −13 plus the length of the month before the end date's month (August, 31 days), which is 18. It reproduces the same answer. For ordinary dates both methods agree; they only part ways when the start day does not exist in a month you pass through.

More worked examples

CaseStartEndYears, months, daysTotal days
A plain case15 June 20152 September 202611 years, 2 months, 18 days4,097
Employment tenure10 March 20239 November 20263 years, 7 months, 30 days1,340
Start on the 31st31 January 20241 March 20240 years, 1 month, 1 day30
Born on 29 February, one year later29 February 202028 February 20211 year, 0 months, 0 days365
Same start, one day further29 February 20201 March 20211 year, 0 months, 1 day366

Leap years and month-ends: where counts disagree

A Gregorian year is a leap year when it divides by 4, except centuries, which must divide by 400. So 2000 and 2024 are leap years and 1900 and 2100 are not. A leap day changes the total days in a span (365 or 366 for a one-year stretch) but not the complete years or months, since those follow the calendar rather than a day count. The only exception is a span that starts or ends on 29 February, as in the last two rows above.

Month-ends are the real source of disagreement. Starting on 31 January, one month later has no 31st to land on. The rule used here clamps to the last day of the shorter month, so 31 January 2024 plus one month is 29 February 2024, and the span to 1 March 2024 is 1 month and 1 day. A tool that rolls forward into March instead would call it 0 months and 30 days. Neither is wrong, but they are different conventions, so if the answer feeds a contract, a benefit or a legal deadline, use the counting rule that document names and not whatever a calculator prefers.

Calculating it in Excel or Google Sheets

With the start date in A2 and the end date in B2:

ResultFormula
Complete years=DATEDIF(A2,B2,"y")
Months after the last whole year=DATEDIF(A2,B2,"ym")
Days after the last whole month=B2-EDATE(A2,DATEDIF(A2,B2,"m"))
Total days=B2-A2
Decimal years=YEARFRAC(A2,B2,1)

DATEDIF is a legacy function. Microsoft documents it but cautions that its "md" option can return incorrect results, which is why the days formula above subtracts an EDATE date instead of using it. YEARFRAC returns a decimal whose value depends on its day-count basis argument, so the figure changes if you pick a different basis. Both spreadsheets and calculators can handle a 31st-of-the-month start differently, so spot-check month-end starts by hand.

Counting an end day: exclusive or inclusive

Everything above counts elapsed time, so 1 January to 2 January is 1 day. If you also count the first day, as some leave and rental rules do, add 1. The days between dates calculator shows both totals side by side. Business-day counts need a different tool again, since they skip weekends: the business days calculator handles that.

When whole years matter

Skip the arithmetic

The years between dates calculator applies the method above to any two dates and shows the years, months, days and totals. For a single unit, use the months between dates calculator or the weeks between dates calculator. For the whole span at once, try the date difference calculator. Nothing you enter is sent anywhere; the sums run in your browser.

Frequently asked questions

How do you calculate the number of years between two dates?

Subtract the earlier year from the later year, then step back one year if the later date falls before the earlier date's month and day in that year. The result is the number of complete years. Whatever remains can be shown as months and days, or as a decimal.

How do you calculate years and months between two dates?

Count the complete months from the start date to the end date, then divide by 12: the quotient is the years and the remainder is the months. The leftover days are what remains between the last whole-month date and the end date.

How many days are in a year when calculating date differences?

A calendar year has 365 days, or 366 in a leap year. For a decimal-year average over long spans, 365.2425 is the mean length of a Gregorian calendar year, which already allows for leap years. Dividing a day count by a flat 365 slightly overstates the years.

Does a leap year change the answer?

It changes the day count but not the complete years and months. 29 February 2020 to 28 February 2021 spans 365 days yet counts as exactly one year under this page's rule, and 1 year and 1 day (366 days) if you run to 1 March 2021. A leap year only changes a whole-years answer if the span begins or ends on 29 February.

How do you calculate years between two dates in Excel?

DATEDIF(start, end, "y") returns complete years and DATEDIF(start, end, "ym") the months left over. DATEDIF is a legacy function, and Microsoft warns that its "md" option can return wrong results, so get the days by subtracting EDATE(start, total months) from the end date instead.

Why do two date calculators sometimes give different months or days?

When the start date is the 29th, 30th or 31st, there is no agreed way to add a month into a shorter one. Some tools clamp to the last day of that month, others roll into the next, and a few count differently again. The years usually agree; the leftover months and days can differ by a day or so.

Note: This guide explains a counting method for general use. Where a contract, statute or form defines its own way of counting years or days, follow that definition.

Calculate years between dates ↗Date difference calculator ↗

More on this topic

Counting the time between dates