Round funcion

4 followers
0
Avatar

I want a rounding function that does the following:


column    result
6.22            6.2
6.27            6.3


Any idea?

Amin Torabi

6 comments

  • Avatar
    Amin Torabi

    Trunc only takes one argument. I want to be able to specify the number of decimal places; so the function should take 2 arguments

    0
  • Avatar
    Joel Stewart

    One technique that could be used if you want to round to the nearest 10th instead is to multiply and divide by 10: ROUND(#MyFloat*10)/10

    This will produce rounding to the nearest 10th. 

    1
  • Avatar
    Will Benica

    Hi Amin,

    I think what you really want is a floor or the rounddown functions. Both round a number down, the second argument is the number of digits after the decimal.

    There's also the ceiling and the roundup function. similar to the above functions.

    If you want to just have a normal round (return the nearest integer) there's the ROUND. This function however doesn't allow you to choose the number of places after the decimal point.

     

    0
  • Avatar
    Amin Torabi

    Will,
    None of them works for me. 
    Roundup takes 6.00001 to 7
    Rounddown takes 6.99999 to 6
    I don't see much usage for these functions.
    I want 6.22 to go to 6.2; and at the same time 6.27 to go to 6.3

    What Joel said is the only possible option I see here.

    0
Please sign in to leave a comment.