ROUNDUP decimal values

Hi all,

Is is possible to ROUNDUP values in xlsforms? So to be clear:

9.1 > 10
10.0 = 10
10.4 = 11

I tried to use the operator ROUND(value, 0) but this doesn't work. Also a 'Ceiling' function is not available. Thanks for answering.

There's probably a more elegant way to do this, but if your field is a, then

if(a mod 1 > 0, int(a) + 1, a)

As the modulo of your number will be the decimal fraction (9 mod 1 = 0, 9.1 mod 1 = 0.1) so only when it's non zero do you need to add 1 to the truncated number to round it up, otherwise leave it (or also truncate it to an integer as well.)

4 Likes

Thanks @ahblake , I found a similar way but the mod approach is much shorter and elegant!