Survey Platform - Math Operations | Qualtrics

Math Operations


Math Operations allow you to create custom values with each response. For example, you can create a function that calculates a formula using Scoring for individual participants. Math Operations can be performed in the Survey Flow, within a question, or choice text.

Survey Flow

Math Operations performed in the Survey Flow should be saved as Embedded Data. The results of the equation are not displayed to the respondent by default. If you would like to display the results of the equation to respondents, you can do so through the use of Piped Text.

In this survey, the answers to two questions are summed, multiplied by 1.33, and saved as an Embedded Data field called Weighted Satisfaction.

Question or Choice Text

Math Operations performed in question or choice text are displayed to the respondent, but are not reported in the survey results.

In this survey, the results of a math operation will be displayed as part of the text in a survey question.

Math Operations Syntax

All math operations are contained within the following syntax:

$e{ }

The math equation will be inserted between { and }. All items in the equation should be separated by a space.

$e{ 4 + 4 }

Using Piped Text

Adding 4 + 4 is great, but more useful is the ability to perform math operations on answers provided in the survey. For example, one study may call for multiplying the answer to a satisfaction question by a fixed number. This is where Piped Text comes in.

Piped Text is used to pull in a dynamic number for each respondent. For a review on how to generate the Piped Text code representing the number needed in your equation, refer to our Piped Text support page.

Piped Text follows a specific format:


To use Piped Text in a math operation, remove the ${ and }. The resulting code would look like this:


Once placed in a math operation, the operation would look like this:

$e{ q://QID1/SelectedChoicesRecode * 4 }

Available Operations

Addition, Subtraction, Multiplication, and Division

$e{ 1 + 2 / 4 * 8 } resolves to 5.

Qtip: For an easy way to perform simple addition, consider using the Scoring feature instead of math operations.


Parentheses may be added to specify order of operations.

$e{ ( 1 + 2 ) / 4 * 8 } resolves to 6.

Qtip: Math Operations follow the standard order of operations: Parentheses, Exponents, Multiplication, Division, Addition, Subtraction.


$e{ 6 ^ 2 } resolves to 36.

Square Roots

$e{ sqrt( 9 ) } resolves to 3.

Using an exponent instead would also be appropriate. For example, $e{ 9 ^ ( 1 / 2 ) }.

Absolute Value

$e{ abs( -23 ) } resolves to 23.


$e{ round( 10 / 3 , 2 ) } rounds 10/3 with 2 decimal places and resolves to 3.33.

Troubleshooting Math Operations

Math operations may not evaluate if they are formatted incorrectly. If your math operation is not evaluating, check for two common errors: HTML spaces in the equation and incorrectly formatted Piped Text.

HTML Spaces

When writing a math equation in the Rich Content Editor, spaces may be converted into HTML, invalidating the equation. The following equation looks fine in the standard view of the Rich Content Editor:


However, switching to the Source View of the text editor, you will notice one of the spaces has been converted to HTML, displayed as “ ”.


  and other HTML tags invalidate a math equation. Remove these from the Source View to fix the equation.

Incorrectly Formatted Piped Text

As discussed above, when using Piped Text in a math operation, $ and {  } should be removed from the Piped Text code. For instance, the Piped Text code ${q://QID1/SelectedChoicesRecode} should be used in a math equation as q://QID1/SelectedChoicesRecode.

Many math operations will work fine if $ and {  } are not removed from the Piped Text. However, if the Piped Text does not have a value (for example, if the respondent skipped the question the Piped Text is referencing) and if $ and {  } have not been removed, the equation will fail.

Remove $ and {  } from all equations to prevent failures when the Piped Text is empty.