Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Count responses and display rank

  • stevehb
  • stevehb's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 1 month ago #126286 by stevehb
Count responses and display rank was created by stevehb
Hi

I have created a survey where I have 7 Basic Statements. I have created 21 "Questions" which are in reality all of the statements laid out in unique pairs. The respondent is asked to go through the question pairs (Radio List with 2 options each) and choose the one that resonates most strongly with them. So they are asked to evaluate A vs B, A vs C, A vs D, A vs E, A vs F, A vs G, B vs C, B vs D, B vs E etc.

At the end of this process I have created a Formula question which effectively lists the answers that have been given to each evaluation. This isn't very sophisticated it just says {AandB} {AandC} {AandD} {AandE} through to {FandG}... These are my very uncreative Question Codes.

My question is, can I now in some way read through this and perform a count of how many times each statement has been chosen and then provide that as output such as:

You Selected Statement A 3 times.
You Selected Statement B 4 times.
You Selected Statement C 6 times.
You Selected Statement D 1 times.
You Selected Statement E 2 times
You Selected Statement F 0 times
You Selected Statement G 5 times.

Supplemental question: If it is possible to do the above, would it also be possible to sort this output so it was in Descending frequency order?

Thanks in advance for any help given.

Steve
The topic has been locked.
  • stevehb
  • stevehb's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 1 month ago - 9 years 1 month ago #126341 by stevehb
Replied by stevehb on topic Count responses and display rank
Just bouncing this up as I'm sort of stuck if nobody has any ideas on how I can do this? Or whether I should abandon this and look for another solution that would allow me to do it.

I'm could I do it by using IF statements in some way?

Thanks
Steve
Last edit: 9 years 1 month ago by stevehb. Reason: I missed a line!
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 1 month ago - 9 years 1 month ago #126349 by tpartner
Replied by tpartner on topic Count responses and display rank
Have a look at Expression Manager - access to functions - count ()

This is untested (done from phone), but for the total of answer code "a" selected, try something like:

Code:
{count(AndB=='a', AandC=='a', AandD=='a', ...)}

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 9 years 1 month ago by tpartner.
The following user(s) said Thank You: first, stevehb
The topic has been locked.
  • stevehb
  • stevehb's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 1 month ago #126351 by stevehb
Replied by stevehb on topic Count responses and display rank
Thanks for the pointer Tony you are a STAR!

For completeness on this bit here is what I've done and it works :-)

{AandB} {AandC} {AandD} {AandE} {AandF} {AandG}

{BandC} {BandD} {BandE} {BandF} {BandG}

{CandD} {CandE} {CandF} {CandG}

{DandE} {DandF} {DandG}

{EandF} {EandG}

{FandG}

The number of times you selected A was {count(AandB=='A', AandC=='A', AandD=='A', AandE=='A', AandF=='A', AandG=='A')}

The number of times you selected B was {count(AandB=='B', BandC=='B', BandD=='B', BandE=='B', BandF=='B', BandG=='B')}

The number of times you selected C was {count(AandC=='C', BandC=='C', CandD=='C', CandE=='C', CandF=='C', CandG=='C')}

The number of times you selected D was {count(AandD=='D', BandD=='D', CandD=='D', DandE=='D', DandF=='D', DandG=='D')}

The number of times you selected E was {count(AandE=='E', BandE=='E', CandE=='E', DandE=='E', EandF=='E', EandG=='E')}

The number of times you selected F was {count(AandF=='F', BandF=='F', CandF=='F', DandF=='F', EandF=='F', FandG=='F')}

The number of times you selected G was {count(AandG=='G', BandG=='G', CandG=='G', DandG=='G', EandG=='G', FandG=='G')}

Anybody got any ideas on how I can sort these in descending count order?

Thanks in advance
Steve
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose