Hi everyoneI'm working on a form for a contest, people will populate th

  • Profile Image
    pablo_randel
    Asked on May 16, 2019 at 03:25 PM

    Hi everyone

    I'm working on a form for a contest, people will populate the blank space with the amount of their purchase at the store. This number needs to be divisible by 15. The result has to be rounded to the nearest whole number. The dynamic is that each purchase of 15 gives them 1 ticket for the contest.

    So if they spend 20 will have just 1 ticket, if they spend 29 will have 1 ticket, it will change to 2 only if they spend 30, 3 for 45, etc.

    Is there a way to calculate this?

    Thanks for your help in advance!



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

  • Profile Image
    stevenmarshall
    Answered on May 16, 2019 at 05:49 PM

    Hi @pablo_randel,

    Can you give us the form URL you are working on? We could assist in setting this up. It might come down to using a few different options for the requirements you are requesting.


  • Profile Image
    pablo_randel
    Answered on May 16, 2019 at 06:02 PM

    Hi Steven

    That's great!

    This is the form: https://www.jotform.com/build/91325486354865


    Where is says: "Cantidad de Acciones para Participar" is where the calculation results will display the numbers of tickets earned, depending of the amount of the purchase on "Monto de la Compra"

  • Profile Image
    Kevin_G
    Answered on May 16, 2019 at 08:07 PM

    Thanks for providing the form in question. 

    I'm a bit confused about the example you provided.

    The result has to be rounded to the nearest whole number. The dynamic is that each purchase of 15 gives them 1 ticket for the contest.

    When you way "the result" are you referring to the division of the entered number with 15 (Number/15)? 

    Or are you referring to the entered number only? 

    So if they spend 20 will have just 1 ticket, if they spend 29 will have 1 ticket, it will change to 2 only if they spend 30, 3 for 45, etc.

    May you please kindly provide a clear example about the result you are expecting? 

    For example, as I understand, this is how it would work: 

    Spent amount: 20 - 29 Tickets: 1

    Spent amount: 30 - 39 Tickets: 2

    Spent amount: 40 - 49 Tickets: 3

    Is this logic correct? 

    Please kindly provide as many details as possible to we can find a workaround. 

    Thanks. 

  • Profile Image
    pablo_randel
    Answered on May 16, 2019 at 08:24 PM

    Hi Kevin thanks for the follow up

    I will try to explain different:

    For every 15 USD spent, people will receive 1 ticket. (There is no fractions, only integer number) 

    Ex. I spent at the store $356. So I will receive 23 tickets (356 / 15 =  23.7333... should display at the result field: 23 tickets total)

    Note: I'm using USD dollars for the examples, on the form is different currency. 

    Thanks

  • Profile Image
    Kevin_G
    Answered on May 16, 2019 at 09:58 PM

    Thank you for the explanation, this indeed helps a lot. 

    I would recommend you to try doing the following: 

    - On your calculation widget "Cantidad de Acciones para participar" add the following formula: 

    15580581932019-05-16_19h55_34.png

    - Here's how you can add the floor function:

    15580582612019-05-16_19h55_34.png

    The floor function will round the value to the nearest integer, here is a guide with more details about the math functions: https://www.jotform.com/help/267-Form-Calculation-Math-Function-Reference 

    The result can also be seen here: https://form.jotform.com/91358717130961 

    I hope this helps. 

  • Profile Image
    pablo_randel
    Answered on May 17, 2019 at 12:40 AM

    Kevin, you're awesome, that calculation is exactly what I needed. Thank you!