Calculate a total from a quantity
For a fixed unit price, multiply a validated quantity by that price. Keep the unit price separate from the accumulating total.
Select a screenshot to enlarge it.
Steps
- Add a Number question for quantity and set sensible minimum and maximum values using the available question options.
- Create variables for the unit price and calculated total in Logic → Customize using data → Variables.
A Number variable stores a starting value. Saved calculation rules determine how answers change it. - Use Branching & Calculations to calculate the intended total from the quantity answer. Check the operation and target variable carefully.
This illustrates the available operation and answer operand. Test totals and changed answers independently before payment use. - Test quantities 0, 1, and several units; then go back and change the answer to detect unintended repeated multiplication.
- If payment is involved, separately verify that the charged amount matches the calculated total.
Check before you rely on it
At a unit price of 12, quantities 1 and 3 should give totals 12 and 36. Use a fresh test when checking the starting state.
If you need help
Repeatedly multiplying an already-updated total can inflate the amount. Do not rely on an untested payment-variable binding.
Contact support with the relevant screen, time, and a redacted description. Keep credentials and private respondent information out of screenshots.