# How to Calculate Number of Months Between Two Dates in Excel

Get FREE Advanced Excel Exercises with Solutions!

Microsoft Excel is one of the greatest tools that 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.

## How to Calculate Number of Months Between Two Dates in Excel: 4 Easy Methods

Let’s say, we have a dataset of some projects launched by an organization, the launching and closing dates of these projects. 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.

🖊️ Steps

• Select cell E5 where you want to find the time span as months and type the following formula in that cell.
`=DATEDIF(C5,D5,"M")`

Here,

• C5 = Launch Date,
• D5 = Closing Date,
• M = The parameter for the number of months to be counted in this function. 📃Note: This function will not calculate the running month, but will stop at the previous completed month.
• Press Enter and you’ll get the number of months as a time span for the first project in cell E5.
• 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)"`

Here,

• C5 = Launch Date,
• D5 = Closing Date,
• Y = Number of Years,
• MD = Number of Days ignoring Months,
• YM = Number of Months ignoring Years. 🗯️Formula Breakdown

Here we’re using DATEDIF functions again but this time we’ll add some text functions like Year(s) 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.

### 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.

`=INT(YEARFRAC(C5,D5,3)*12)`

Here,

• C5 = Launch Date,
• D5 = Closing Date,
• 3 = 365 day count basis. 🗯️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.

`=ROUNDUP(YEARFRAC(C5,D5,3)*12,0)`

Here,

• 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.

### 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. The MONTH function returns the month, a number from 1 (January) to 12 (December).

Apply the following formula to get the number of months.

`=(YEAR(D5)-YEAR(C5))*12+MONTH(D5)-MONTH(C5)`

Here,

• C5 = Launch Date,
• D5 = Closing Date. 🗯️Formula Breakdown

What we’re doing here in cell E5 is-

1.  Finding the differences between years,
2. Converting years into months,
3. Adding differences between the ranks or orders of two months.

### 4. Subtracting MONTH Functions

In this last part of all methods, we’ll now combine multiple MONTH functions with a 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.

`=MONTH(D5)-MONTH(C5)`

Here,

• 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.

## 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. 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.

## Conclusion

In this article, I’ve tried to illustrate each of the methods to calculate the 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. If you have 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. 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 Advanced Excel Exercises with Solutions PDF  