Skip to main content

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

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates  |  Delete Blank Rows  |  Combine Columns or Cells without Losing Data  |  Round without Formula ...
Super VLookup: Multiple Criteria  |  Multiple Value  |  Across Multi-Sheets  |  Fuzzy Lookup...
Adv. Drop-down List: Easy Drop Down List  |  Dependent Drop Down List  |  Multi-select Drop Down List...
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  Compare Columns to Select Same & Different Cells ...
Featured Features: Grid Focus  |  Design View  |  Big Formula Bar  |  Workbook & Sheet Manager | Resource Library (Auto Text)  |  Date Picker  |  Combine Worksheets  |  Encrypt/Decrypt Cells  |  Send Emails by List  |  Super Filter  |  Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters ...)  |  50+ Chart Types (Gantt Chart ...)  |  40+ Practical Formulas (Calculate age based on birthday ...)  |  19 Insertion Tools (Insert QR Code, Insert Picture from Path ...)  |  12 Conversion Tools (Numbers to Words, Currency Conversion ...)  |  7 Merge & Split Tools (Advanced Combine Rows, Split Excel Cells ...)  |  ... and more

Kutools for Excel Boasts Over 300 Features, Ensuring That What You Need is Just A Click Away...

Description


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, Edge and Firefox.
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
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations