Excel stores dates in the following manner:
40814.45069
If you enter that number into a cell, then change the cell format to DATE, it will display:
9/28/2011 10:49am
Pretty slick, the whole numbers are days, and the decimal values are a fraction of the day.
The INT() function will look at any number and give you the value without decimals. you said you didn't care about the times, so the INT() function effectively strips them out.
So the formula INT(B1)-INT(A1) will subtract the second date from the first. The result will be some whole number.
Ok so far? So based on the two dates you gave, that formula calculates like so:
=INT(B1)-INT(A1)
=INT(09/28/2011 10:49)-INT(09/27/2011 0:00)
=40814-40813
Result: 1
Ok so far?
Now, we insert the formula into a MAX() function. MAX() looks at a series of numbers and returns the highest value in the range. I fed in the first value of .5 since you said you wanted that to be the minimum. Then the INT() formula will calculate the other value, then MAX will present the higher of the two numbers.
=MAX(0.5, INT(B1)-INT(A1))
=MAX(0.5, 1)
Result: 1
|