How to Calculate Number of Months Between Two Dates in Excel

Microsoft Excel is one of the greatest tools which allows you to find the number of months between any two dates by providing a number of unique functions. Through these functions, you’ll be able to find out the time span of any incident or someone’s age at once by inserting two fixed dates only.

Download Practice Workbook

You can download our Excel workbook which we’ve used to prepare this article. You can also use this practice book as a calculator by inputting dates in the specific fields to work out the number of months between two dates as instructed.

4 Easy Methods to Find Number of Months Between Two Dates in Excel

Let’s say, we have a dataset of some projects launched by an organization, the launching and closing dates of these projects.

Dataset to Find Number of Months Between Two Dates in Excel

We want to find out the number of months taken to close the project. We will discuss the ways in which our purpose can be served.

In this section, you will be familiar with 4 easy methods to find the number of months between two dates in Excel. I will discuss them with proper illustrations here. Let’s check them now!

1. Using DATEDIF Function

The DATEDIF function returns the difference of days, months, or years between two dates, based on three arguments, one starting end, one ending date, and one argument called unit. We will show the direct and customized form of this function to find out the number of months between the concerning dates.

1.1. Applying DATEDIF Function Directly

We have to find the number of months as the time span of all projects. We’ll use the DATEDIF function here directly. In order to do so, follow the steps below.

🖊️ Steps

  • At first, select a cell (i.e. E5) where you want to find the time span as months and type the following formula in that cell.



  • C5 = Launch Date
  • D5 = Closing Date
  • M = the parameter for the number of months to be counted in this function

DATEDIF function to Find Number of two Months Between Dates in Excel

📃Note: This function will not calculate the running month, but will stop at the previous completed month.
  • Then, press Enter and you’ll get the number of months as a time span for the first project in cell E5.
  • Now, drag the Fill Handle tool down to Autofill the formula for the other cells.

  • Hence, all the cells will bring you the number of months from calculating these two dates.

📃Note: If we use ‘Y'(Years) or ‘D'(Days) in lieu of ‘M'(Months) in the parameter part inside the function bar, we’ll get the differences between two dates as a number of years or days too.

1.2. Customizing DATEDIF Function

Now you’ll be able to learn how you can find out the number of years, months, and days together between two dates by customizing the DATEDIF function.

Just, create the following formula by customizing the DATEDIF function for finding the number of months between the encountered dates and apply it to your data.

=DATEDIF(C5,D5,”Y”)&” Year(s) “&DATEDIF(C5,D5,”YM”)&” Month(s) “& DATEDIF(C5,D5,”MD”)&” Day(s)”


  • C5 = Launch Date
  • D5 = Closing Date
  • Y = number of Years
  • MD = number of Days ignoring Months
  • YM = number of Months ignoring Years

🗯️Formula Breakdown

So, here we’re using DATEDIF functions again but this time we’ll add some text functions like “Year(s)” too by using Ampersand(&) which will create spaces between words or number(s).

Before 3 units of time, we’re using the DATEDIF function every time to find out the number of years, months, and days separately.

Read More: Excel Formula to Calculate Number of Days Between Today and Another Date

Similar Readings

2. Inserting YEARFRAC Function 

Now we’re going to use the YEARFRAC function to work with the previous dataset. The YEARFRAC function returns the year fraction representing the number of whole days between start_date and end_date on the basis of whole_days.

2.1. YEARFRAC Wrapped with INT Function

The INT function is used to get the nearest integer. So, wrapping up the YEARFRAC function with the INT function will turn the fractional value of the year into an integer.

So, apply the following formula to a selected cell.



  • C5 = Launch Date
  • D5 = Closing Date
  • 3 = 365 day count basis

YEARFRAC function to find Number of Months Between Dates in Excel

🗯️Formula Breakdown

Here, we’re finding out the number of years as time span first which will be shown in decimal format. Then this value will be multiplied by 12 (No. of months in a year). We’ll use the INT function at the initial to convert decimal into integer format.

You’ll see the same result as found before.

  • Now, drag the formula again like before to find out the number of months as the time span for the rest of the projects.

2.2. YEARFRAC Function Wrapped with ROUNDUP Function

We can use the ROUNDUP function instead of the INT function too at the initial. But there’s a difference between these 2 functions.



  • C5 = Launch Date
  • D5 = Closing Date

The INT function won’t round off the decimal value so it’ll omit the decimal parts even if it’s too close to the next integer value.

But the ROUNDUP function will allow you to round off the number up to a fixed decimal place or the nearest whole number according to your choice.

Read More: How to Count Months from Date to Today by Using Excel Formula

3. Combining YEAR and MONTH Functions 

Here’s another method you can also use to get the same results. And we’ll combine YEAR and MONTH functions in this method. The YEAR function returns the year of a date, an integer in the range 1900-9999. And the MONTH function returns the month, a number from 1 (January) to 12 (December).

Apply the following formula to get the number of months.



  • C5 = Launch Date
  • D5 = Closing Date

YEAR and MONTH function to Find Number of Months Between Dates in Excel

🗯️Formula Breakdown

What we’re doing here in Cell E5 is-

  1. i) Finding the differences between years,
  2. ii) Converting years into months,

iii) Adding differences between the ranks or orders of two months.

Read More: Calculate Years and Months between Two Dates in Excel (6 Approaches)

4. Subtracting MONTH Functions

In this last part of all methods, we’ll now combine MONTH functions with simple subtraction formula.

What you have to do here is subtract an old date from a new date by using the MONTH function for both dates and you’re done.



  • C5 = Launch Date
  • D5 = Closing Date

Note: This method has a drawback. It’ll allow you to find the number of differences between two months only within a fixed year.

Read More: [Fixed!] VALUE Error (#VALUE!) When Subtracting Time in Excel

Months Calculator for Two Dates

Here, I am providing you a calculator in which you can just input dates and get the number of months between the dates.


In this article, I’ve tried to illustrate each of the methods to calculate number of months between two dates in Excel in a convenient way as possible. I hope, this article has guided you through the proper instructions thoroughly as  If you got any question(s) or feedback regarding this article you can comment. You can also go through other useful articles related to basic and advanced Excel functions on our website.

Further Readings

Nehad Ulfat

Nehad Ulfat

Hello, Welcome to my profile. I'm a Technical Content Creator as well as a Naval Architect & Marine Engineer. I have preferences to do analytical reasoning & writing articles on various statistical data. Here, you'll find my published articles on Microsoft Excel & other topics related to my interests!

We will be happy to hear your thoughts

Leave a reply

5 Excel Hacks You Never Knew

Genius tips to help you unlock Excel's hidden features