I am interested in assigning numeric values to items selected from a list in the choices tab, then using to calculate a result. I assume this is possible, but am not having any luck with he syntax I'm using. Here's my example:
Question: Please select one of the items below
(from list name "items")
A
B
C
D
user selects one or more values in list.
I have a separate type field called "score" in which I want to assign values to items in the list if they are checked, then calculate a value (let's say I select A and B), assign a value to the selected (A=1, B=1), and add all the values. if A and B are selected, result would be 2.
I know there has to be a simple answer...
thanks
Dave
Solved! Go to Solution.
Hi David,
This can be done by using the selected() function to check if a response is selected paired with an if() function to assign a value when selected. Assuming A=1,B=1,C=2,D=2:
if(selected(${q}, 'A'), 1, 0) + if(selected(${q}, 'B'), 1, 0) + if(selected(${q}, 'C'), 2, 0) + if(selected(${q}, 'D'), 2, 0)
If all choices are associated with the same value, you could use [value]*count-selected(). For example, if all choices match to a value of 1,
count-selected(${q})
is the correct function.
Hi David,
This can be done by using the selected() function to check if a response is selected paired with an if() function to assign a value when selected. Assuming A=1,B=1,C=2,D=2:
if(selected(${q}, 'A'), 1, 0) + if(selected(${q}, 'B'), 1, 0) + if(selected(${q}, 'C'), 2, 0) + if(selected(${q}, 'D'), 2, 0)
If all choices are associated with the same value, you could use [value]*count-selected(). For example, if all choices match to a value of 1,
count-selected(${q})
is the correct function.
That did it. Thanks. I was using the list name and not the question name in my calculation. Appreciate it James!
/DG