How can I set up a field to round the result of a calculation to the nearest whole number?

  • DDorrell
    Asked on August 11, 2017 at 2:27 PM

    We have a form that calculates a number of free chaperones based on the number of students attending the event. One chaperone free for every 10 students paid. I want a field to show the number of free chaperones but rounded to the nearest whole number, by student increments of 10. So if there are 22 students attending, the result would be 2 chaperones. Then if there are 26 students attending, there would still be 2 chaperones. Right now I can get the field calculation to round, but after .5 it rounds up - not what I need.

  • Kiran Support Team Lead
    Replied on August 11, 2017 at 2:46 PM

    I understand that you want to calculate the 'Free Chaperones Included' to round down based on the number of students count. 

    How can I set up a field to round the result of a calculation to the nearest whole number? Image 1 Screenshot 40

    You may consider adding the function floor() to the calculation in the widget so that it should be working correctly. Please see the screenshot below:

    How can I set up a field to round the result of a calculation to the nearest whole number? Image 2 Screenshot 51

    You may get the floor() function by clicking on ... icon. 

    How can I set up a field to round the result of a calculation to the nearest whole number? Image 3 Screenshot 62

    If you want to round up the value, you may use ceil() function.

    Hope this information helps! 

  • DDorrell
    Replied on August 11, 2017 at 3:43 PM
    That was exactly what I needed! Thank you!
    ...