Archive of Mr Excel Message Board


Back to Dates in Excel archive index
Back to archive home



calculating the number of days between 2 dates

Posted by Chris Jones on September 04, 2001 12:52 PM
Hey there,

I want to calculate the number of the number of days the occur between the date in cell g6 and e6. I've tried the 360DAYS worksheet function, it didn't work, and I tried DAY(G6)-DAY(E6, which is ok for calculating between 2 dates in the same month, but goes out of wack when a different month is involved in calculation.

I've been trying the following:


=IF(G5="","",DATEDIF((G5),(E5),"D"))

But it gives me a #NUM! error.

Does anyone know how to do this?


Re: calculating the number of days between 2 dates

Posted by Mark W. on September 04, 2001 12:58 PM
=G6-E6 or =ABS(G6-E6)


Re: calculating the number of days between 2 dates

Posted by Aladin Akyurek on September 04, 2001 12:59 PM
Chris,

The syntax for DATEDIF is:

=DATEDIF(earlier-date,later-date,"d")

"d" makes this function to return the number of days between two dates.

If G5 is expected to house a later date value than E5, use:

=IF(ISNUMBER(G5),DATEDIF(E5,G5,"d"),"")

Aladin

=========== I want to calculate the number of the number of days the occur between the date in cell g6 and e6. I've tried the 360DAYS worksheet function, it didn't work, and I tried DAY(G6)-DAY(E6, which is ok for calculating between 2 dates in the same month, but goes out of wack when a different month is involved in calculation.




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.