Is there a way to round up a number to the nearest 0.5? For example:
0.18 -->0.5
0.46 -->0.5
1.87 -->2
1.17 --> 1.5
I tried round(value, 0.5) but it only round to the nearest 0.5. 0.18 --> 0 and 1.17-->1.0
Solved! Go to Solution.
Hi @thaodinh95 ,
From what I know, there is no direct way of calculation what you need, but we have a workaround using a few expressions 🙂
Best,
Fernando Vizcaino
Hi @thaodinh95
Try this exprsssion
if [Field1]-floor([Field1]) in (0,0.5) then
[field1]
else
round([Field1]+.25,0.5)
endif
It handles the special cases of when the number has no decimal or ends in 0.5 by returning the number. If it's not one of these, the +.25 pushes the number into the proper range to have the internal Round() function work properly
Dan
Thanks Dan! This works marvelously.
This works great! I would not be able to come up with the formulas by my own. Probably need time to digest the methodology.
Have you tried:
ceil([Field1]*2)/2