# Calculating Dates

• ### Question

• I have MOSS 2007

Here is my question how do I calculate dates to get how many days are between two dates excluding time.

This works fine in one way =DATEDIF([Creation Time],[MSI Start Date and Time],"d"), but if the creation date is let say today and the MSI Start Date and Time is 3 days previous I will get #NUM or -3 type problems I have tried everything I know or have found

What I need it to do is either way the dates are in the fields is to give me a solid 1 or 2 etc.

I have tried  =IF([Creation Time]>=[MSI Start Date and Time],DATEDIF([Creation Time],[MSI Start Date and Time],"d",IF(([Creation Time]<=[MSI Start Date and Time],DATEDIF([Creation Time],[MSI Start Date and Time],"d"))

And have attempted so many variations with the same results

But it says I have invalid  errors any help would be approeciated.

Wednesday, November 2, 2011 7:49 PM

• Hi,

You can try this:

=IF([Creation Time]>=[MSI Start Date and Time],DATEDIF([MSI Start Date and Time],[Creation Time],"d"),DATEDIF([Creation Time],[MSI Start Date and Time],"d"))

Hope this helps.

Thanks,

Pengyu Zhao

• Marked as answer by Friday, November 11, 2011 10:34 AM
Friday, November 4, 2011 2:28 AM