1. Home
2. Other Resources
3. Tips & Tricks
4. Calculating the average score of all answers to a matrix question

# Calculating the average score of all answers to a matrix question

If you want to use a value assignment for a question in the survey (e.g. a matrix question), you can include this element behind the matrix question in the survey. Suppose you have included 4 services in the matrix question to be rated by the survey participants with a number between 1 (Very poor) and 5 (Excellent).

Note: In order to use a value assignment, at least one custom variable must have been created.

The values/numbers that can be set for each rating criterion can be defined in the columns of the question, e.g.

• Very poor > Value 1
• Poor > Value 2
• Good > Value 3
• Very good > Value 4
• Excellent > Value 5

The lowest score a participant can assign to the 4 services of the survey question (here: q1) is: 4 x Very poor = 4 * 1 = 4. The highest score, on the other hand, is equal to 4 x Excellent = 4 * 5 = 20.

###### Define value assignment

In order to calculate the average service score of a participant, for example, proceed as follows:

After having clicked the Create Variable button, you have to create a custom variable (combination of a unique name and data type), e.g. Average (Real number) on a window. In the text box under Is equal to the following term: you can define the corresponding formula, e.g. (q1_1+q1_2+q1_3+q1_4)/4. The scores of the various services are first added up and its total is then divided by 4 (= number of services). The figure below shows how this formula is incorporated into the survey.

• q1_1 = the specified service in the first row of question q1
• q1_2 = the specified service in the second row of question q1
• q1_3 = the specified service in the third row of question q1
• q1_4 = the specified service in the fourth row of question q1
• /4 = the division factor

When a participant now fills out the survey, his/her scores for the various services (here: 4) will be added together and subsequently be divided by 4. If you want to display the average service score to a participant, you can include another text block under the value assignment element in the survey. In this text block, you can enter the following information, among others:

• Text: The average score is:
• Placeholder: The placeholder – such as`{{custom.Average}}`– can be selected on the RTE window.

Note: Custom variables can also be used as placeholders and filter conditions in the survey. Moreover, you can also retrieve them in the raw data of the survey.

An alternative formula can also be used to calculate an average service score of a participant.

Again, you must create a custom variable (combination of a unique name and data type) on a window, e.g. Average3 (Real number). In the text box under Is equal to the following term: you should this time not enter the formula (q1_1+q1_2+q1_3+q1_4)/4, BUT the formula mean(q1_1,q1_2,q1_3,q1_4). In this case, the scores of the various services are also added together and the total obtained is also directly divided by 4 (= number of services in the example). In the figure below, you can view how this formula is incorporated into the survey.

This function provides you with an alternative calculation method. In order to display the average service score to a participant, you can also include another text block below the value assignment element in the survey.

After you have entered the text (e.g. The average score is:) in this text block, you can include the appropriate placeholder for the corresponding value assignment (in this example: Average3). You can select this placeholder `{{custom.Average3}}` in the RTE window (1).

When creating a custom variable, you can choose from the following data types: String, Date, Integer number and Real number. Click here for more information on these data types.

These options (at the bottom right of the screen) indicate when the value assignment should be carried out.

• Only the first time the participant passes this point
Only the first time the respondent accesses this element, the calculation will be carried out. If the respondent clicks the Back button, followed by the Next button, the value - based on the value assignment - will not be re-determined.
• Every time the participant passes this point (default)
Each time the respondent accesses this element, the calculation will be carried out. If the respondent clicks the Back button, followed by the Next button, the value - based on the value assignment - will be re-determined.
• Anytime (immediately after every change to an involved variable)
As soon as the survey participant alters one of the values in one of the fields on a page in the survey, the value assignment calculation will also be updated accordingly.