Round funcion

Comments

6 comments

  • Grant Eaton

    Hi Amin,

    Did you try the TRUNC function to truncate the decimals?

    0
    Comment actions Permalink
  • 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
    Comment actions Permalink
  • 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
    Comment actions Permalink
  • Amin Torabi

    Great! Thanks Joel.

    0
    Comment actions Permalink
  • 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
    Comment actions Permalink
  • 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
    Comment actions Permalink

Please sign in to leave a comment.