Months Between Two Dates

Excel Formulas › Date & Time

All versionsDATEDIF

Count the months between two dates — whole months for tenure or subscription length, or a fractional figure for prorating. DATEDIF and a little arithmetic each have their place.


Quick formula: whole months between B1 and B2:
=DATEDIF(B1, B2, "m")
Returns complete months. For an approximate decimal, use (B2-B1)/30.44 (avg month length).

Functions used (tap for the full reference guide):

The example

Months between two dates.

AB
1SpanMonths
2Jan 15 → Jun 175

The formula

Whole months elapsed:

=DATEDIF(B1, B2, "m") // complete months between

How it works

Choose whole or fractional months:

  1. Whole months: DATEDIF(start, end, "m") counts complete months, ignoring leftover days.
  2. Months + days: add DATEDIF(…, "md") for the remaining days.
  3. Calendar-month difference (ignoring the day): (YEAR(B2)-YEAR(B1))*12 + MONTH(B2)-MONTH(B1).
  4. Approx decimal: (B2-B1)/30.44 for prorating — not exact, but fine for estimates.

Billing-month count often wants the calendar-month formula (the (YEAR…)*12+… version), which counts month boundaries crossed regardless of the day — e.g. Jan 31 to Feb 1 is “1 month” for billing even though DATEDIF’s "m" returns 0.

Try it: interactive demo

Live demo

Two dates → months between.

Whole · Calendar

Variations

Months + days

Add the remainder:

=DATEDIF(B1,B2,"m")&"m "&DATEDIF(B1,B2,"md")&"d"

Calendar months

Boundaries crossed:

=(YEAR(B2)-YEAR(B1))*12 + MONTH(B2)-MONTH(B1)

Approx decimal

For prorating:

=(B2-B1)/30.44

Pitfalls & errors

"m" is whole months. Jan 31 to Feb 28 is 0 complete months by DATEDIF, which can surprise — use the calendar-month formula for billing.

Order matters. Start before end, or DATEDIF returns #NUM!.

Decimal is approximate. 30.44 is an average; for exact prorating use day counts within each month.

Practice workbook

📊
Download the free Months Between Two Dates practice workbook
A months-between calculator with months+days, calendar-month, and decimal variants, plus 4 challenges with answers. No sign-up required.

Frequently asked questions

How do I count months between two dates in Excel?
Use =DATEDIF(start, end, "m") for complete months. For calendar months crossed regardless of day, use (YEAR(end)-YEAR(start))*12 + MONTH(end)-MONTH(start).
How do I get months and leftover days?
Combine codes: =DATEDIF(B1,B2,"m")&"m "&DATEDIF(B1,B2,"md")&"d".
Why does DATEDIF return one fewer month than I expect?
"m" counts only complete months, so Jan 31 to Feb 28 is 0. Use the calendar-month formula for billing-style counts.

Stop fighting formulas. Learn them in a day.

This recipe is one of hundreds of real-world formulas we teach. Our Excel Formulas & Functions class covers lookups, logic, text, and dynamic arrays hands-on — live in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.

See the Formulas & Functions Class

Related formulas: Exact age (y/m/d) · Add months to a date · Age in weeks & months

Function references: DATEDIF