Round up with criteria

studio

#1

Hi guys, do anyone have idea on how to round up the number as listed below:
If the string is 28.1 then the output should be 28.5
28.1 --> 28.5
28.2 --> 28.5
28.3 --> 28.5
28.4 --> 28.5
28.5 --> 28.5
28.6 --> 29.0
28.7 --> 29.0
28.8 --> 29.0
28.9 --> 29.0
Anyone have any idea to cater this?


#2

Hi @Serran_Neru,

Math.Round(value)

Regards,
Arivu


#3

Hi @arivu96

Using that syntax will give output as below, which is not as desired
28.1 --> 28
28.2 --> 28
28.3 --> 28
28.4 --> 28
28.5 --> 28
28.6 --> 29
28.7 --> 29
28.8 --> 29
28.9 --> 29

Any other way that can cater as desired?


#4

Hi @Serran_Neru,
Try this

(Math.Ceiling(2 * value)) / 2

Regards,
Arivu


#5

That perfectly work, thanks arivu :slight_smile: