[Back]  [Print Page]
Keywords: x

Description: Describes how to create formulas to show dynamic output in a text question.

You can use a formula to show a calculated value based on question answers in the text of your survey.  Here is the syntax you use to insert a formula in a text question:

<{ Insert Formula Here }>

Formula Examples

The following are some examples of formulas you might use in a survey.

1. Show the total of questions 1-3:
Your total for all divisions is : <{ [Q1] + [Q2] + [Q3] }>

2. Show feedback text based on the user's answer:
<{ IF([Q1]=="Yes","That answer is correct", "That answer is incorrect") }>

3. Show a formatted numeric answer:
Your surplus/deficit is <{ tostring([Q1] - [Q2], FMT_DLR+FMT_SEP) }>

Further Information

To use the values from questions in your survey, use pipe codes (e.g. [Q1] or [V1]) in the formula.  For more information, see the Using Piping page.

For techncial reference about building formulas, see the Formula Operators and Formula Commands pages.

For details about coding question answers with a different value than what is displayed to the user (i.e. assigning a score to answers), see the Assigning a Value to Answers page.

You can add a Calculated Question if you want to store the formula result to see in your results analysis or use in Piping, Ask if Logic or other formulas.  For more details see Calculated Questions.