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.
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.
- Press ENTER and Fill Handle the rest of the required cells.
Here is the result.
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.
- Press ENTER. Drag the Fill Handle icon to the rest of the cells.
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.
- Press ENTER and drag the Fill Handle all the way.
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.
- Press ENTER.
Here is the result.
Download the Practice Workbook
Download the following Excel file for your practice.
Related Articles
- How to Subtract Dates in Excel to Get Years
- How to Minus Number of Days or a Date from Today in Excel
<< Go Back to Subtract Dates | Date-Time in Excel | Learn Excel
Get FREE Advanced Excel Exercises with Solutions!