Note: The other languages of the website are Google-translated. Back to English

Excel Formula: Count Months Between Two Dates

doc convert date to julia 1

In this tutorial, it provides formulas to count months between two given dates.

If you want to follow along with this tutorial, please download the example spreadsheet.
doc convert date to julia 1

Get number of complete months between dates

 

Generic formula:

DATEDIF(start_date,end_date,”M”)

Syntaxt and Arguments

Start_date, end_date: the two dates that you want to get months difference between.

Return Value

The formula returns a whole numeric value that indicates the number of months.

Error Value

1 While the start_date is greater than the end_date, the formula returns an error value #NUM!

2 While the start_date or end_date is not valid dates (a text value or not a valid date in Excel such as dates before 1/1/1900), the formula returns an error value #VALUE!

How this formula works

To count the number of months between dates in cell B3 and C3, please use below formula:

=DATEDIF(B3,C3,"M")

Press Enter key and drag fill handle over the cells that need this formula.
doc convert date to julia 1
doc convert date to julia 1

Explanation

DATEDIF function: returns the number of complete years, months or days between dates.

Remark

The formula calculates and round the number of months down, if you want to get the nearest whole month, you can use the formula as this:

DATEDIF(start_date,end_date+15,"M")

doc convert date to julia 1

Get number of decimal months between dates

 

Generic Formula

YEARFRAC(date1,date2)*12

Syntax and Arguments

Date1, date2: the two dates that you count the number of months based on.

Return Value

The formula returns a value in date format, and you need to format the result as number.

How the formula works

To count the months between the dates in cell B3 and C3, please use the formula as this:

=YEARFRAC(C3,B3)*12

Press Enter key then drag fill handle down to the cells for applying this formula.

doc convert date to julia 1

Keep the formula result selected, and press Ctrl + 1 to display the Format Cells dialog, then under Number tab, click Date from the Category list, choose the date type you want to display in the Type section.
doc convert date to julia 1

Click OK, the result is shown as date.
doc convert date to julia 1

Explanation

YEARFRAC function: calculates the fractional year in a decimal format between given dates. Basic formula is YEARFRAC(date1,date2), to multiply 12 at the end of the formula, will get the fractional months in a decimal format between dates.

Remark

If you want to get the whole number of months by the YEARFRAC function, you can add the INT function in the front of the YEARFRAC function like this:

INT(YEARFRAC(date1,date2)*12)

doc convert date to julia 1

It counts month rounded down.


Relative Formulas

Relative Functions


The Best Office Productivity Tools

Kutools for Excel - Helps You To Stand Out From Crowd

Would you like to complete your daily work quickly and perfectly? Kutools for Excel brings 300 powerful advanced features (Combine workbooks, sum by color, split cell contents, convert date, and so on...) and save 80% time for you.

  • Designed for 1500 work scenarios, helps you solve 80% Excel problems.
  • Reduce thousands of keyboard and mouse clicks every day, relieve your tired eyes and hands.
  • Become an Excel expert in 3 minutes. No longer need to remember any painful formulas and VBA codes.
  • 30-day unlimited free trial. 60-day money back guarantee. Free upgrade and support for 2 years.
Ribbon of Excel (with Kutools for Excel installed)

Office Tab - Enable Tabbed Reading and Editing in Microsoft Office (include Excel)

  • One second to switch between dozens of open documents!
  • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
  • Increases your productivity by 50% when viewing and editing multiple documents.
  • Brings Efficient Tabs to Office (include Excel), Just Like Chrome, Firefox, And New Internet Explorer.
Screen Shot of Excel (with Office Tab installed)
Comments (1)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Wenn man statt "Komma" Semikolon benutzt funktioniert es auch !
There are no comments posted here yet

Follow Us

Copyright © 2009 - www.extendoffice.com. | All rights reserved. Powered by ExtendOffice. | Sitemap
Microsoft and the Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.
Protected by Sectigo SSL