What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.
At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.
We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.
How to round number to nearest 25 centsAsked by acpacentertix on August 29, 2015 at 10:57 PM
I need to round up to the nearest $0.25; but the Ceiling function only allows me to round up to the nearest whole number. How can I do this?
This is a re-post of a comment on Form Calculation - Math Function Reference
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.
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!
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.
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
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.