Calculations
A Calculation field works out a number from other answers, such as a total price. People see the answer as they fill in the form, and can't change it.
Steps
- Open the form in the Form builder.
- Drag the Calculation field from Form fields onto your form. It is called "Total" to start with. Change the Question if you like.
- Under Work it out, choose what to Start with: a question, or A number… and type it.
- Click + Add another step. Choose plus, minus, times or divided by, then a question or a number.
- Add more steps as needed, up to 20.
- Under Show the answer as, choose Dollars, like $12.50, A number, like 12.5 or A whole number, like 13.
- Click Save in the settings window, then Save at the top of the builder.
Example
For a ticket order: Start with Tickets, then times 25, then plus Donation.
How the answers count
- Steps are worked out left to right, like a calculator. There are no brackets, so 2 plus 3 times 4 gives 20.
- A choice counts as the number in its option, so "Adult ($25)" counts as 25.
- With Choose several, the ticked options are added up.
- A ticked Tick box counts as 1.
- An empty answer counts as 0. Dividing by 0 gives 0.
- You can use number, amount, short answer, dropdown, Choose one, Choose several and Tick box questions. Questions inside a repeat group can't be used.
Good to know
- Formhub works the answer out again when the form is sent, so a number changed in the browser counts for nothing.
- If the Calculation sits in a hidden section, it gives no answer (see Show or hide questions).
- To charge the total by card, add a Payment field and choose The amount in a question, such as a Calculation total. See Take card payments in a form.
- The answer appears on the response like any other answer.
Still stuck? Inside Formhub, press Ask Yasmene at the bottom right, or send us a message.