Round Up Function

  • Hello,

    Can anyone help me?

    I want to round up my result.

    I use round ((value/60),0). It works ok when

    The result

     

    11.91 becomes 12

     

    when the result is 4.03 becomes 4 ( in mathematical theory is correct) but I want to be able to round up this to 5 instead of 4.

     

    what should I do? Any suggestion

     

    Basically I want my result appear like below

     

    11.91 becomes 12

    0.5      becomes 1

    10.1  becomes  11

    18.45 becomes 19

    40.83 becomes 41

     

    Thanks,

    Susan

     

     

  • Sure... Use CEILING() instead of ROUND().

    -Lance

  • ... or, more generally, add half the last increment before rounding. eg, if you want to round up to one decimal place, use ROUND(number + 0.05, 1). Subtracc half the last increment to round down. If using floats, it might be safer to use 0.049999999999 to allow for the slight inaccuracy in that data type.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply