Google Sheets inherited the best tool for counting months between dates: the DATEDIF function, with exactly the same syntax it has in Excel. The difference is attitude. Where Excel hides DATEDIF as a legacy leftover, Google documents it in the open, autocompletes it as you type, and treats it as a normal part of the function library. This guide gives you the formulas, a worked example, the fallback formula for people who prefer to see the working, and the two Sheets-specific traps - locale date formats and text dates - that cause most of the wrong answers.
The formula
With the start date in A1 and the end date in B1:
=DATEDIF(A1,B1,"M") returns the complete months between the dates, counted by the anniversary rule: a month counts when the same day of the month comes round again.
=DATEDIF(A1,B1,"MD") returns the leftover days after those complete months.
=DATEDIF(A1,B1,"D") returns the total days, for checking.
All six DATEDIF units - Y, M, D, YM, MD and YD - work in Sheets exactly as they do in Excel. Our guide on DATEDIF units explains each one with a shared example, and everything in it applies to Sheets unchanged.

Worked example
Set A1 to February 10, 2026 and B1 to September 30, 2026 - say, the start of a pregnancy tracker and a date near the end of it. The formulas return:
| Formula | Result | Why |
|---|---|---|
=DATEDIF(A1,B1,"M") | 7 | The 10th comes round seven times, the last on September 10 |
=DATEDIF(A1,B1,"MD") | 20 | September 10 to September 30 is 20 days |
=DATEDIF(A1,B1,"D") | 232 | The full span in days - the check figure |
So the span is 7 months and 20 days. Type the same dates into the months between dates calculator and you will get the same answer, because both use the anniversary rule described in our guide on how to calculate months between two dates. Agreement between two independent methods is the cheapest accuracy check there is.
The fallback: months without DATEDIF
Some people prefer a formula whose working they can see, and some shared files avoid DATEDIF out of habit. The anniversary rule can be written out longhand. Full months:
=(YEAR(B1)-YEAR(A1))*12+MONTH(B1)-MONTH(A1)-(DAY(B1)<DAY(A1))
Read it in pieces: the year and month difference gives the raw month gap, and the last term subtracts 1 whenever the end day has not yet reached the start day - exactly the step 3 adjustment from the hand method. In Sheets the comparison returns TRUE or FALSE, and Sheets treats TRUE as 1 in arithmetic, so the formula works as written. (In Excel, wrap the comparison as --(DAY(B1)<DAY(A1)) to force the same conversion.) Then the leftover days, with the full-months formula sitting in cell C1:
=B1-EDATE(A1,C1)
EDATE adds whole calendar months to a date and clamps to the end of a short month, so this leftover is correct even for spans starting on the 31st. On the worked example, the fallback returns the same 7 months and 20 days.
The two Sheets traps
Locale date formats. A Google Sheet interprets typed dates using the locale set under File, Settings. A US-locale sheet reads 02/10/2026 as February 10; a UK-locale sheet reads it as October 2 - and both will happily calculate with the date they assumed, giving a month count that is wrong by eight months with no error anywhere. The defence is the DATE function: =DATE(2026,2,10) means February 10, 2026 in every locale on earth. Use it for any date that decides something.
Text dates. Dates pasted from web pages, PDFs and other systems often arrive as text. They look like dates, sort like text, and make DATEDIF return #NUM! or, worse, a silent wrong answer elsewhere in the sheet. The test is the same as in Excel: apply a long date format. Real dates reformat; text does not. Replace text dates with DATE-function values and the problem is gone for good. If your file also lives in Excel, our Excel DATEDIF guide covers the same traps from that side.
Filling the formula down a whole list
Real sheets rarely hold one pair of dates. If you have a list of start dates in column A and end dates in column B, put the DATEDIF formula in C1 with relative references and double-click the fill handle, and Sheets copies it down the whole list, one count per row. For a shared tracker that other people add rows to, an array formula in the header cell does the job permanently: =ARRAYFORMULA(IF(A2:A="","",DATEDIF(A2:A,B2:B,"M"))) fills itself for every row, present and future, and skips the blanks. Pair it with the same array using "MD" in the next column and the sheet reports months and leftover days for the whole list at once - the format a careful count deserves.
Checking the answer outside the sheet
A month count that feeds a due date, a contract or a payment deserves a second method. The months between dates calculator gives you the anniversary-rule answer with no formulas to mistype, and the days between calculator on the homepage gives the raw day total - 232 in the worked example - which any correct month answer must reconcile with. If the sheet and the tools disagree, the cause is almost always a locale-flipped date or a text date, and now you know how to find both.
Frequently asked questions
Does Google Sheets have DATEDIF?
Yes. Sheets includes DATEDIF with the same syntax and the same six units as Excel, and Google documents it openly in the Sheets function help. The main difference from Excel is that Sheets will autocomplete the function name as you type, which makes it easier to discover.
Why does my date show as a big number like 46063?
That is the date's serial number - Sheets and Excel store dates as a count of days, and the cell is formatted as a plain number instead of a date. The value is fine. Select the cell and apply Format, Number, Date and it will display as a date again. Formulas like DATEDIF work on the serial number either way.
How do I enter a date that Sheets cannot misread?
Use the DATE function: =DATE(2026,2,10) always means February 10, 2026, whatever the spreadsheet's locale. Typed dates are the risky ones, because a sheet set to a day-first locale reads 02/10/2026 as October 2. ISO format, 2026-02-10, is also read correctly in most locales.
Can I count months in Google Sheets without DATEDIF?
Yes. Full months can be built from the YEAR, MONTH and DAY functions: =(YEAR(B1)-YEAR(A1))*12+MONTH(B1)-MONTH(A1)-(DAY(B1)<DAY(A1)), and the leftover days are =B1-EDATE(A1, full months). The fallback is worth knowing for shared files, and it makes the anniversary rule visible in the formula itself.
Why does DATEDIF return #NUM! in Google Sheets?
For the same two reasons as in Excel: the start date is later than the end date, which DATEDIF will not count, or one of the inputs is text that looks like a date rather than a real date value. Swap the dates if needed, and re-enter any pasted date with the DATE function to be sure it is a value Sheets can calculate with.
Related guides
How to calculate months between dates in Excel with DATEDIF
The original DATEDIF guide, with the hidden-function backstory.
DATEDIF units explained - Y, M, D, YM, MD and YD
What every unit counts, and what every unit ignores.
How to add months to a date
EDATE and the other ways to move a date forward by months.
How to calculate months between two dates
The hand method behind every formula on this page.
