# Calculate difference in months between two dates

#### goodmachine

##### Board Regular
Hello,

I want to calculate the difference in months between two dates. For example, in cell B2, I have 12/31/2014. In cell A2, I have A2, I have 5/3/2014. The days of the month will vary, so this may be messy.

What I'm looking for is a calculation that will tell me that there would be 7 months between the two dates on the based on the months. I would like to not consider the days of the month. Is that possible.

If yes, the second part of this formula would multiply a value in cell C2 (11 in this example). Roughly what I'm looking for is something that would result in:

(B2-A2)*C2 = 77.

### Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.

#### vogel997

##### Active Member
 Try =MONTH(B2)-MONTH(A2)
<colgroup><col width="347" style="width: 260pt; mso-width-source: userset; mso-width-alt: 12690;"> <tbody> </tbody>

#### gorem

##### Board Regular
 Try =MONTH(B2)-MONTH(A2)

<tbody>
</tbody>
This will only work if the two months are in the same year

#### vogel997

##### Active Member
 Try =MONTH(B2)-MONTH(A2)

<tbody>
</tbody>

 Try 3-May 31-Dec 11 77 =(MONTH(B2)-MONTH(A2))*C2 21-May 8-Feb 11 99 =IF(MONTH(B3)-MONTH(A3)<0,MONTH(B3)-MONTH(A3)+12,MONTH(B3)-MONTH(A3))*C3
<colgroup><col width="64" style="width: 48pt;" span="3"> <col width="129" style="width: 97pt; mso-width-source: userset; mso-width-alt: 4717;"> <col width="764" style="width: 573pt; mso-width-source: userset; mso-width-alt: 27940;"> <col width="64" style="width: 48pt;"> <tbody> </tbody>

#### goodmachine

##### Board Regular
 Try 3-May 31-Dec 11 77 =(MONTH(B2)-MONTH(A2))*C2 21-May 8-Feb 11 99 =IF(MONTH(B3)-MONTH(A3)<0,MONTH(B3)-MONTH(A3)+12,MONTH(B3)-MONTH(A3))*C3

<tbody>
</tbody>

Thank you Vogel. Your solution worked. And thanks to everybody else for contributing. Much appreciated.

#### goodmachine

##### Board Regular
Gorem is correct, Vogel's solution only works if the year is the same. Is there a way for this formula to consider the year in it's calculation as well?

#### goodmachine

##### Board Regular
I tried AhoyNC's solution and the formula returned a Number Error.

#### vds1

##### Well-known Member
Try,

=DATEDIF(A2,B2,"m")*C2