# How to round number to nearest 25 cents

• acpacentertix
Asked on August 29, 2015 at 10:57 PM

I want to round up to the nearest 0.25 USD; but the Ceiling function only allows to rounding up the nearest whole number. How can I round the nearest 0.25 USD?

This is a re-post of a comment on Form Calculation - Math Function Reference

• BJoanna
Answered on August 30, 2015 at 04:32 AM

If I understood you correctly you want to round your number to 1 decimal place.

If that is the case inside of Form Calculation widget field, click on Show Advanced options and change Decimal Places in Numerical Results.

I have made sample form with two calculations. First is rounding calculation to two decimals and second to one decimal place.

Here is my form: http://form.jotformpro.com/form/52412169964965?

If I did not understood you correctly please explain in more details what you are trying to achieve and also provide us ID of the form you are working on.

Hope this will help. Let us know if you need further assistance.

• acpacentertix
Answered on September 01, 2015 at 03:17 PM

In my case, I am working with dollar amounts and need to round up to the nearest 25 cents (0.25). Generally, the ceiling function allows setting an increment for rounding (i.e. 1.07 up to 1.25, 2.35 up to 2.50;  etc.). I notice that even if I add the code that sets an increment, it is ignored (i.e. ceiling(x,.25)). Is there another solution to set the increment?

Thanks for all your help!

• BJoanna
Answered on September 01, 2015 at 05:26 PM

You can try to achieve that with Form Calculation - Math Function floor(number) option and setting condition for each value.

then just check with conditions if 0.xy > 0 and 0.xy < 0.25 ===>  floor(number) + 0.25

if > 0.25 and < than 0.5 then ===> floor(number) + 0.50

the same logic can then be used for 0.75 and 100

where for 100 it can either use floor(number) + 1

I have made demo form but it only works with numbers less than 1. Here is my demo form:

Feel free to clone it if you want to take closer look to my conditions.

• acpacentertix
Answered on September 03, 2015 at 04:25 PM

Eureka! You've inspired me.

I solved this by calculating the ceiling for 4 times the value and then dividing the result by 4 (e.g. (ceiling(4*x))/4

Many thanks!

• Boris
Answered on September 03, 2015 at 09:39 PM

On behalf of my colleague, you are very much welcome!

We are glad to hear about your workaround. I'm sure it will come in handy for other users in the future as well.

Thank you for updating us. Please don't hesitate to contact us again if you need any other assistance with your forms, we will be happy to help.