how to calculate the number of months between two dates?

bigdan

Well-known Member
Joined
Oct 5, 2009
Messages
846
Office Version
  1. 2013
Platform
  1. Windows
I have a number of dates in a column. In each case I'd like to see how many months between the dates in that column, and another date, say Oct 31. I don't care about the number of days, just number of months.

So if I see a date like May 1, I'd like to see the difference between that and Oct 31 in months ie 6.

How would I do that?
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Thanks! Will this be consistent whether the dates are the beginning or end of the month? Ie I'd like the diff b/w 5/1 and 10/31 to be 6 months but 5/31 to 10/31 be 5 months.

When I tried your formula as is it gave me 5 mths as the diff b/w 5/1 and 10/31 and again 5 mths as the diff b/w 5/31 and 10/31. I tried adding 1 to the formula ( so I made it DATEDIF(A1,B1,"m") +1 ) but that gave unexpected results. First it gave me the answer in a date format. When I changed the format back to numbers it gave me 6 as the result (for both 5/1 and 5/31).

What did seem to work is when I modified the formula to become DATEDIF(A1,B1 +1,"m") ie adding the 1 in the second argument. That seems to work! But I'm only saying that on a small sample set. Would the logic be consistent? I don't really follow it.


 
Upvote 0
I'm not sure, do a Google for DATEDIF and see what it says.
I believe this is an undocumented feature of Excel so information may be sparse.
 
Upvote 0

Forum statistics

Threads
1,223,105
Messages
6,170,128
Members
452,304
Latest member
Thelingly95

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top