ROUND() not working as I expect

I feel like I'm missing something really simple here, but the round function is not working as I'm expecting. I am wanting to divide a number (vehicle mileage) by 1000 and round it to the nearest 5 and then adding 5. I'm using this function:

ROUND([Mileage at Last Service Date]/5000)*5+5

When I test it, this is one of the results:

McKenna_Killion_0-1662065235960.png

159880/5000 = 31.976 so I was expecting it to round to 32, not 31. Does this function not follow rounding based on being under or above .5 ? 

Solved Solved
0 4 129
1 ACCEPTED SOLUTION

Please try an expression of 

ROUND([Mileage at Last Service Date]/5000.000)*5+5

For decimal division, AppSheet expects numerator or divisor to be in decimals.

 

View solution in original post

4 REPLIES 4

TeeSee1_0-1662085473143.png

Make sure you take care of Number vs Decimal types correctly.

Number/Number gives in effect a FLOOR result. (i.e 5/2 gives you 2)

Thank you! I knew I was missing something simple like this. 

Please try an expression of 

ROUND([Mileage at Last Service Date]/5000.000)*5+5

For decimal division, AppSheet expects numerator or divisor to be in decimals.

 

That worked perfectly. Thank you

Top Labels in this Space