开发者

ROUNDDOWN in Excel

I have a run开发者_StackOverflowdown code in Excel. It returns a decimal value when it should return a date value.

The value in the cell K5 is 2011-08-16 18:29:58 and the value in O5 is 3.

=IF(AND(K5>(ROUNDDOWN(K5,0)+0.75),O5=6),ROUNDDOWN(K5,0)+3.375,IF(O5=7,ROUNDDOWN(K5,0)+2.375,IF(O5=1,ROUNDDOWN(K5,0)+1.375,IF(AND(K5<(ROUNDDOWN(K5,0)+0.375),O5=2),ROUNDDOWN(K5,0)+0.375,
IF(K5<ROUNDDOWN(K5,0)+0.375,ROUNDDOWN(K5,0)+0.375,IF(K5>ROUNDDOWN(K5,0)+0.75,ROUNDDOWN(K5,0)+1.375,K5))))))


It's a formatting issue. Try formatting the cell with the formula the same as K5 is formatted. When I do that I get 8/17/2011 9:00.
Excel stores dates as decimal values. 1/1/1900 is equal to 1, 1/2/1900 is 2, etc. The decimal part of the date gives you the hour of that day, e.g., 1.5 = 1/1/1900 12:00 noon. You can read more at: http://www.ozgrid.com/Excel/ExcelDateandTimes.htm

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜