Formula for spanned months

yee388

Well-known Member
Joined
Mar 7, 2004
Messages
1,374
I have two columns of dates:

1/1/06 --- 2/10/06
12/26/05 --- 3/25/06
8/27/05 --- 9/12/05

I want a formula for the number of months spanned.

so, for the above dates,

Jan, Feb = 2
Dec, Jan, Feb, Mar = 4
Aug, Sept = 2

Thanks!
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

colbymack

Active Member
Joined
Jul 14, 2005
Messages
333
Does this work for you:
=((YEAR(E5)-YEAR(D5))*12)+MONTH(E5)-MONTH(D5)

Where E5 has the later date, and D5 has the earlier date.
 

colbymack

Active Member
Joined
Jul 14, 2005
Messages
333
Sorry - you will want to add 1 at the end of that formula. I forgot that Dec to Mar =4, and not 3 (or 3.something)
 

yee388

Well-known Member
Joined
Mar 7, 2004
Messages
1,374
Perfect, colbymack. I love it when it's just that simple.

Barry, I haven't tried yours, but thanks for the effort.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,802
Messages
5,833,755
Members
430,230
Latest member
Doug G

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
Top