## Round funcion

4 followers

I want a rounding function that does the following:

column    result
6.22            6.2
6.27            6.3

Any idea?

Amin Torabi

• Grant Eaton

Hi Amin,

Did you try the TRUNC function to truncate the decimals?

• 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

• 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.

• Amin Torabi

Great! Thanks Joel.

• 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.

• 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.