The Difference Between Two Dates in Months in Excel (4 Examples)

Let’s first introduce our dataset. It contains the launch and closing dates of some random projects. We aim to calculate the difference between two dates in months in Excel.

4 Effective Ways to Get Difference Between Two Dates in Months in Excel


Method 1 – Using the DATEDIF Function 

Steps:

  • Enter the following formula in cell D5:
=DATEDIF(B5,C5,"M")

Here, B5 stands for the launch date, C5 stands for the closing date, and M stands for the month.

Using DATEDIF Function to Find Difference Between Two Dates in Months in Excel

  • Press ENTER and Fill Handle the rest of the required cells.

Using DATEDIF Function to Find Difference Between Two Dates in Months in Excel

Here is the result.

Using DATEDIF Function to Find Difference Between Two Dates in Months in Excel

Note: The DATEDIF function doesn’t count the running month.

Read More: How to Calculate Time Difference in Excel Between Two Dates


Method 2 – Using YEARFRAC along with INT or ROUNDUP Functions

Steps:

  • Enter the following formula in cell D5:
=INT(YEARFRAC(B5,C5)*12)

The YEARFRAC function calculates the number of years in decimals between two dates. Then, we use the INT function to convert a decimal to a whole number after multiplying by 12.

Using YEARFRAC along with INT or ROUNDUP Functions

  • Press ENTER. Drag the Fill Handle icon to the rest of the cells.

Using YEARFRAC along with INT or ROUNDUP Functions

Here is the result.

Note: We can use the ROUNDUP function instead of the INT function. The INT function only rounds off the decimal, even if it is closest to a whole number. On the other hand, the ROUNDUP function returns the nearest whole number to a fixed decimal number according to round-off rules.

Read More: Calculate Time Difference Between Two Dates in Minutes in Excel


Method 3 – Combining YEAR and MONTH Functions 

Steps:

  • Enter the following formula into cell D5:
=(YEAR(C5)-YEAR(B5))*12+MONTH(C5)-MONTH(B5)

Here, at first, the YEAR function returns the difference between two dates in years. Then, after multiplying by 12, it is converted into months. Finally, it is added to the difference between two dates in months, resulting in the the MONTH function.

Combining YEAR & MONTH Functions

  • Press ENTER and drag the Fill Handle all the way.

Combining YEAR & MONTH Functions

Here is the result.


Method 4 – Using a Subtraction Formula with Excel MONTH Function

Steps:

  • Enter the following formula into cell D5:
=MONTH(C5)-MONTH(B5)

Here, the MONTH function only returns the date difference in months within a fixed year.

Using Subtraction Formula with MONTH Function

  • Press ENTER.

Here is the result.

Using Subtraction Formula with MONTH Function


Download the Practice Workbook

Download the following Excel file for your practice.


Related Articles


<< Go Back to Subtract Dates | Date-Time in Excel | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Hafizul Islam
Hafizul Islam

Hafizul Islam is an excellent marine engineer who loves working with Excel and diving into VBA programming. For him, programming is like a superhero tool that saves time when dealing with data, files, and the internet. His skills go beyond the basics, including Rhino3D, Maxsurf C++, AutoCAD, Deep Neural Networks, and Machine Learning. He got his B.Sc in Naval Architecture & Marine Engineering from BUET, and now he's switched gears, working as a content developer. In this role,... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo