**Formulas** is a great feature that allows you to calculate an average, custom score, average results and any advanced calculations, using the data and items from your questionnaire. You can use the /*-+() characteristics to create formulas that use variables like answers or quiz scores to calculate an average, for example.

**DEFINITION**

Formulas are variables that allow you to calculate scores, averages, and any advanced calculations that you wish to, later on, use in your survey, final page, email template, or even PDF Report. This feature is built upon piping variables.

This guide will teach you:

- How to create a formula
- Test your formula
- Advanced formula calculations
- How can your formula be used
- How to use formulas to calculate averages

## 1. How to create a formula

1.1 Creating a formula in the software

1.2 Creating formulas outside the software

### 1.1 Creating a formula in the software

To create your own formula, make sure that your questionnaire is completed and that you have already enabled the custom score. Then head straight to the Extra Options tab and select Formulas in the Custom Scoring section.

Click on the **Create formula** button and insert all the data. Let's see how you can do that.

- Title: Name your formula. Make it something that will be clear to you, if you want to come back to edit it.
- Variable: You cannot edit the variable but only copy it to use later on in outcomes, email templates, or results. This will actually return the result of the calculation wherever you use the variable.
- The formula: Use the circled symbols to put your formula together or click Variables {x} to access the drop-down menu of questionnaire variables that you can use. For example, you could write:

*|q1_custom_score|**(*|q2_custom_score|*-*|q3_custom_score|*)

### 1.2 Creating formulas outside the software

Now let's see how to build the formula outside the software.

**TIP**

If you are looking for an example file to import your formulas, you can download one here.

Click** Import formulas** to get started.

Select the File you want to upload.

Once you upload your file, it should look like this:

## 2. Test your formula

To test out how your setup will work, just click Test and your calculation will be displayed below based on a previous response.

#### WARNING

You need at least ONE response in order for your test to work, as the test will be based on the last response.

#### NOTE

The test button does not work on formulas where the "include all survey responses" is enabled.

## 3. Advanced formula calculations

If you want to add more advanced calculations, you can use different variables:

- *|q1_custom_score|* - the score value for the specific question the respondent gets (in this case q1).
- *|total_custom_score|* - the value of all custom scores for all questions together (the score of the respondent).
- *|max_possible_custom_score|* - the maximum score for the whole questionnaire.
- *|total_custom_score_percentage|* - the value of the custom score as a percentage compared to the max score.
- *|qb1_custom_score|* - the custom score value for the question block you have created (in this case qb1).
- *|qb1_max_custom_score|* - the maximum total score for one question block.
- *|q1_field1_response|* - the response that is collected on the form field of question 1.
- *|q1_response|*- the response of a question that the answer is numeric (in this case q1).

For advanced users, we recommend Math, a built-in object that has properties and methods for mathematical constants and functions. More information can be found here.

#### NOTE

Although it is possible to create advanced formulas using the Math object, the test can only parse numerical values. To test these advanced formulas you would be required to collect a new response for the questionnaire and look at the formula results.

## 4. How can your formula be used?

After your formulas are created, you can use them in your outcomes, email templates, final screen, intro fields, PDF Reports, and so on. The purpose is to display the data without having to change it in the questionnaire.

As an example we will show how to create (4.1) an outcome that will be displayed based on the value of the formula, (4.2) send an email after survey completion, depending on the result, and (4.3) formulas displaying scores as percentages on the final screen.

4.2 Email template based on formulas

4.3 Formulas to show scores in your final screens

### 4.1 Outcome-based on formula

After you have created your formulas as described above, click on the Outcomes feature in Extra options. See the Outcomes guide for full details about setting up your Outcome screen. We'll just look at the final part, which is where the Formula function comes in. You'll need to select Show this outcome when a certain condition is met. From the drop-down menu, click Formula.

Now use the drop-down menus that will come up to choose which one you want to use, how it should be used, and what the values should be.

Click Apply and your Outcome is now set to be shown with the right formula value.

### 4.2 Email template based on formulas

Once you have saved your settings, click on the Email templates feature in Extra options. See the email template guide for full details about setting up your email templates. When you need to specify when to send the email, this is where the Formula function comes in. Just click on the arrow and select Formula.

Now you can choose which formula you want to be used and for which values you want the email to be sent out. Click Apply, and you're all set.

### 4.3 Formulas to show scores in your final screens

Formulas can also be used together with custom scores to create a final screen or outcome(s) where respondents will see their scores as a percentage for each set of questions. You can simply use the variables (see section 1) to show the results in your outcome screen or final screen.

You can also use the variable *|f_result_ranking_table|* to easily insert a table with results of all the formulas ordered from highest to lowest. The steps are similar to those shown in this video, with setting up custom scores and formulas.

#### WARNING

If you re-order or delete a question that has question logic (rules) attached to it, you'll see a pop-up screen that shows the impact of these changes.

## 5. How to use formulas to calculate averages

If you're on the Enterprise or ReportR plan, you'll see a button underneath the formula box, which you can toggle to include all survey responses in this formula calculation.

Turning on this feature will allow calculations to be made using data from the survey to calculate averages, for example. This allows you to show data in the PDF report for the entire population or from all responses received rather than from just one response.

Formula filters are available on the ReportR plan only. You can add custom filters so that the formula is only calculated for respondents who meet certain conditions. Read the full guide about calculating formulas from all responses and using formula filters.

**TIP**

You can also toggle the button "Use rounded numbers" to round the numbers of your results.

## What's next?

- Use question logic to add points to a formula. Use this handy combination to calculate scores, to keep a count (for example, how many times a respondent answered "yes" throughout the survey), or show different outcome screens for different formula results. Read all about using question logic to add to formula.
Add the Formula KPI widget to display the results of the formulas that you have just set up. You can use this widget to have a quick visual representation of your formulas. KPI stands for key performance indicator, a quantifiable measure of performance over time for a specific objective.

Add the Formula Ranking widget to display the results of selected formulas ranked from lowest score to highest score or highest to lowest. The result of each formula that you choose to show will be displayed together with explanatory text immediately underneath.

That's all! Now log in and try out the formulas feature for yourself!