Step-By-Step
Use code to perform math operations in your survey. You can then display the output to the respondent and record it in your data.
Set up a Math Operation
- Paste the following code into your question text or answer choice text:
-
$e{ your expression here }
- Replace “your expression here” with the math operation you want to use. The output for the expression will be displayed wherever you put the code into your survey. Examples:
- $e{4 + 4} — Resolves to 8.
- $e{(4+4)/2} — Resolves to 4.
- $e{4*4} — Resolves to 16.
Use Piped Text in a Math Operation
If you want to run an equation using numbers that were entered by the respondent in a previous question, you can use piped text code:
Record the Output
To record the output of the equation with your data
- Place your math operation code into the question where you want the output displayed to the respondent.

- Click the Survey Flow button and then click Add a New Element Here.

- Make the element an Embedded Data element.

- Click Output.

- Click Set a Value Now and paste your math operation code in as the value.

Your downloaded data will contain a column called “output” which will contain the outputs for each respondent.
More Information
Qtips
- Remember the order of operations. Operations within parentheses will be evaluated before the rest of the operations.
- Division operations can sometimes generate a number with many decimal places. For example, $e{10/3} resolves to 3.333333333. To round, place the word “round” in your code and specify the number of decimal places you would like displayed.
-
Example: $e{round(10/3,2)} will now resolve to 3.33. The “round” tells it to round up or down, and the “,2” tells it to round to two decimal places after the operation is done.
