Embedding scores within Limesurvey answers

2 months 2 weeks ago #197576 by ZeinaKamareddine
Hi all.

I am using Limesurvey to collect data for my study, and one of the questionnaires (a 26-item questionnaire) I have requires giving a total score at the end for the participant to see.

For example, for a question "How often do you sleep 8 hours a night?", there are 6 possible answers that the participant can choose:


However, I want to set conditions for calculations such that for each question:

Always = 3
Usually = 2
Often = 1
Sometimes = 0
Rarely = 0
Never = 0

After all items are converted to these scores, the scores are added up to give a total score for the 26 items.

Is it possible to put such conditions, and for a total score to appear? If so, how?

Thank you so much for the help!

Please Log in to join the conversation.

LimeSurvey Partners
2 months 2 weeks ago - 2 months 2 weeks ago #197587 by holch
You should have a look into Expression Manager/Script in the manual.

It can do exactly what you want. We generally don't use the "assessment mode" anymore, because it is not as flexible as using expressions for the calculation of these scores. But I sometimes like to use the "assessment value" fields of questions (only available when assessment mode is switched on), because it makes the calculations of this type of scores easier, because you don not need to check which answer was given and then give it a value within the expression, but you could just access the assessment value from the given answer and use it in your calculations.

Let's say you have two questions, let's call them Q1 and Q2. Let's keep it simple for now, but let's use your example:

Q1: How often do you sleep 8h or more a night?
1 - Always = 3
2 - Usually = 2
3 - Often = 1
4 - Sometimes = 0
5 - Rarely = 0
6 - Never = 0

Q2: How often do you exercise per week?
1 - 4 or more times = 3
2 - 2-3 times = 2
3 - 1 time = 1
4 - Never = 0

So the first number is the answer code and the number after the answer would be what you put into the assessment field.

Then you create a equation type question to calculate the score (let's call it Q3).

So with my solution using the assessment values you could calculate your score like this.

This is for single choice questions, for questions with subquestions (multiple choice, array, etc) it is a little bit more complicated, but nothing out of this world.

Now, if you would not use the assessment value the whole thing would be a lot longer.

To make it simpler I would probably create 3 equation questions, because otherwise you would have to use IF statements and it can get quite confusing and it is easy to make mistakes, when your item battery is longer than 3.

So first I would store the score for Q1 into Q3a:
{if(Q1>3,0, if(Q1==3,1, if(Q1==2,2, if(Q1==1,3,""))))}

Then I would calculate the score for Q2 into Q3b:
{if(Q2>3,0, if(Q2==3,1, if(Q2==2,2, if(Q2==1,3,""))))}

And then I would sum them up into Q3c:

Of course you could make the same calculation in one question here, but it makes it a lot more difficult to check for errors and the more you have in one equation, the messier it gets.

However, with using the assessment values as base for the calculations you can make things a lot cleaner and simpler, in my opinion. This is why I still like to have the assessment mode there, just for being able to give scores to answers. I am not using the assessment mode for calculating the assessments though. For the calculations themselves I much prefer using equations, they give you so much more flexibility.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Last edit: 2 months 2 weeks ago by holch.

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now