Archive of Mr Excel Message Board


Back to Dates in Excel archive index
Back to archive home

Counting number of months between dates

Posted by Debbie on May 23, 2000 12:50 PM
I need to calculate the number of months between two dates. (EX 7/02/98 to 03/15/2000 would be 21 months). The fields are in date format.

Can it be done with a formula? I have tried several things with no success. I know there is an easy solution but it has me stumped.


Re: Counting number of months between dates

Posted by Jac on May 23, 2000 2:58 PM
Debbie,

This may be over-simplifying things, but have you tried this:

=(date2-date1)/30

or (3/15/00 minus 7/02/98 equals 622days)divided by 30 days per month.

this gives me 20.73 months.

I tried to play around with the MONTH function, but didn't get anywhere.

Good luck!


Re: Counting number of months between dates

Posted by Celia on May 23, 2000 3:12 PM

Debbie
If the earlier date is in cell A1 and the later date is in cell A2 :-
=DATEDIF(A1,A2,"m")
This will give the rounded down difference in months.

I got this formula from :-http://www.cpearson.com/excel/datedif.htm

There is a lot of other useful info on working with dates at :-
http://www.cpearson.com/excel/topic.htm

Celia


Re: Counting number of months between dates

Posted by thomas venn on May 23, 2000 4:32 PM
=round((date1-date2)/30) or =roundup((date1-date2)/30)

it has worked for me before.

regards,

thomas


Re: Counting number of months between dates

Posted by Debbie on May 23, 2000 5:06 PM

THANKS!!!!! the Pearson site is a great site. I really appreciate you sharing this info.


Re: Counting number of months between dates

Posted by Ivan Moala on May 23, 2000 6:09 PM
Debbie
The DatedIf function has no help for it.
Chip mantions some examples.
Here is some additional info on the function
which should be similar to the lotus fuction.


From MS help
Calculates the number of days, months, or years between two dates. This function is provided for compatibility with Lotus 1-2-3.

Syntax

DATEDIF(start_date,end_date,unit)

Start_date is a date that represents the first, or starting, date of the period. Dates may be entered as text strings within quotation marks (for example, "2001/1/30"), as serial numbers (for example, 36921, which represents January 30, 2001, if you're using the 1900 date system), or as the results of other formulas or functions (for example, DATEVALUE("2001/1/30")). For more information about date serial numbers, see NOW.

End_date is a date that represents the last, or ending, date of the period.

Unit is the type of information you want returned.

Unit Returns
"Y" The number of complete years in the period.
"M" The number of complete months in the period.
"D" The number of days in the period.
"MD" The difference between the days in start_date and end_date. The months and years of the dates are ignored.
"YM" The difference between the months in start_date and end_date. The days and years of the dates are ignored.
"YD" The difference between the days of start_date and end_date. The years of the dates are ignored.


Remarks

Microsoft Excel stores dates as sequential serial numbers so that it can perform calculations on them. Excel stores January 1, 1900, as serial number 1 if your workbook uses the 1900 date system. If your workbook uses the 1904 date system, Excel stores January 1, 1904, as serial number 0 (January 2, 1904, is serial number 1). For example, in the 1900 date system, Excel stores January 1, 1998, as serial number 35796 because it is 35,795 days after January 1, 1900. Learn more about how Microsoft Excel stores dates and times.


Ivan


Twist: I need to count week days between days, any help?

Posted by Carol Bentley on May 25, 2000 1:04 PM

I have read all the DATEDIF ideas and they are great, but I need to count week days (Monday-Friday) between dates. I know Excell has some sort of functionality like this, because I am able to Fill a Series of Week Day dates in a spreadsheet. Does anyone have any ideas?


Re: Twist: I need to count week days between days, any help?

Posted by Jade on June 01, 2000 10:24 AM
I just discovered this today when I ran into the same problem.
NETWORKDAYS(date1,date2)

Re: Counting number of months between dates

Posted by Jade on June 01, 2000 10:25 AM
I just discovered this function today when I had the same problem.
NETWORKDAYS(Date1,Date2)

This archive is from the original message board at www.MrExcel.com.
All contents © 1998-2004 MrExcel.com.
Visit our online store to buy searchable CD's with thousands of VBA and Excel answers.
Microsoft Excel is a registered trademark of the Microsoft Corporation.
MrExcel is a registered trademark of Tickling Keys, Inc.