T
trost
They both yield #NUM when the input is a negative number.
trost said:They both yield #NUM when the input is a negative number.
....zan said:Seems a bit arbitrary for the cell to have to test for errors and
unusual cases though.
....Gord Dibben said:Both the number and the significance have to have same sign...
trost said:They both yield #NUM when the input is a negative number.
zan said:SIGN didn't have the expected results for negative numbers.
FLOOR:
=IF(SIGN(zz)<0,-1*CEILING(ABS(zz),significance),FLOOR(zz,significance))
CEILING:
=IF(SIGN(zz)<0,-1*FLOOR(ABS(zz),significance),CEILING(zz,significance))
....Dave Peterson said:Do you recall how Lotus 123 handled these two functions--or if they even had
them?
....zan said:SIGN didn't have the expected results for negative numbers.
Given -12,000 as the input value and 5,000 as the significance, I need a
result of -15,000 for floor, -10,000 for ceiling.
Harlan said:...
123 never had either @CEILING or @FLOOR. Instead it had an optional
3rd argument to its @ROUNDM function, which is roughly comparable to
Excel's ATP's MROUND function. In 123
@ROUNDM(x,y,@SIGN(x)) and @ROUNDM(X,Y,-@SIGN(X))
produce the same results as Excel's
=SIGN(x)*CEILING(ABS(x),ABS(y)) and =SIGN(x)*FLOOR(ABS(x),ABS(y))
respectively. Excel's perverse behavior is entirely MSFT's fault.
Harlan Grove said:You want ROUNDUP and ROUNDDOWN rather than CEILING and FLOOR.
'ceiling': =y*ROUNDUP(x/y,0)
'floor': =y*ROUNDDOWN(x/y,0)
The point is: ROUNDDOWN always goes toward zero,
and ROUNDDOWN always goes away from zero.