{"skills":[{"name":"Count multi-select survey answers","description":"Report how many respondents chose each option, with an explicit denominator for a question that allowed several choices.","content":"# Count multi-select survey answers\n\nReport how many respondents chose each option, with an explicit denominator for a question that allowed several choices.\n\n## When to use this skill\n\n- A survey question let people tick more than one option and someone wants counts and percentages.\n- The export mixes skipped answers, people routed past the question and people who never responded.\n- The option percentages add up to more than 100% and someone wants to know whether that is right.\n\n## When not to use it\n\n- Weighting results to a population or testing whether differences between groups are significant. That needs the survey's design weights and a statistical method.\n- Coding free-text Other answers into themes. Count them as Other and code the text separately.\n\n## What you need\n\n- Question wording, valid choices in display order, and the answer recorded for each respondent.\n- Skip logic, missing-answer codes, and whether an explicit None is an allowed response.\n\n## Ask before you start\n\nIf any of these are missing or unclear, ask before doing the work.\n\n- What was the exact question and its options in order, including any None or Don't know option, and is that option exclusive?\n- Who was asked the question? Routing or skip logic decides who belongs in the base.\n- How does the export record a skipped question, a person routed past it and an invitee who never started?\n\n## Method\n\n1. Define the question-level base from the survey routing and response-status records. Separate recorded item skips from people routed past the question and invitees who never responded. If the export cannot make that distinction, say so.\n2. Split each answer using the export's documented encoding and remove a choice repeated within one person's answer. Count an explicit None as an answered question if it was offered.\n3. Hold for review any answer that combines an exclusive option such as None with another option. Leave it out of the base and the option counts until it is resolved.\n4. For each listed option, count the distinct valid respondents who selected it. Divide by the number of eligible respondents who answered. A base of zero gives no percentage.\n5. Round each percentage to one decimal place only after dividing, and do not force the percentages to total 100%.\n6. Report the base, the skipped count and the percentages together, and list the responses held for review.\n\n## Checks before you deliver\n\n- Percent of selections uses a different denominator. Labelling it as percent of people misstates the result.\n- Percentages of respondents can sum to more than 100 when people select several options.\n- Including invitees who never started, or people routed past the question, in the base.\n- Treating a blank as None. An explicit None is an answer; a blank is a skip.\n- Counting an option twice when the export repeats it within one answer.\n\n## How to present the result\n\nLead with the base: how many eligible people answered, how many skipped, and that several choices were allowed. Then give a table in the questionnaire's option order with the count and percent of respondents for each. List any responses held for review and why, and note that the percentages can total more than 100%.\n\n## Worked example\n\n**Request:** Summarise valid respondents. Allowed choices in order: Talks, Walks, None. A dash is blank.\n\n**Supplied material:**\n\n```text\nid|eligible|choices\nA|yes|Talks;Walks\nB|yes|Walks;Walks\nC|no|-\nD|yes|-\nE|yes|None\n```\n\n**Answer:** Of three valid respondents, one selected Talks (33.3%), two selected Walks (66.7%) and one selected None (33.3%). One eligible person skipped the question. Multiple selections were allowed.\n\n## Structured output for tests\n\nFor an ordinary job, answer in the format above and point back to the supplied evidence. Use this structure only for the test cases published with this skill, or when someone asks for structured JSON.\n\nReturn answered and skipped as counts of eligible valid answers and eligible blank answers; review as respondent IDs needing clarification; options as objects with option, count and percent in supplied choice order. Exclude review cases from both counts. Round percent to one decimal or use null for a zero base.\n\n## Sources\n\n- [SurveyMonkey: checkboxes question](https:\/\/help.surveymonkey.com\/en\/surveymonkey\/create\/checkbox\/): SurveyMonkey explains that response percentages for a checkbox question may exceed 100% because the total number of choices selected can be greater than the number of people who answered.\n- [US Census Bureau: item nonresponse rates](https:\/\/www.census.gov\/newsroom\/blogs\/random-samplings\/2021\/08\/2020-census-operational-quality-metrics-item-nonresponse-rates.html): The Census Bureau defines item nonresponse as a respondent giving some information but not answering every question, and unit nonresponse as no response at all from an address. The skill keeps item skips and nonrespondents apart for the same reason.\n\nTest cases and an answer checker for this skill: https:\/\/skills.raq.com\/skills\/count-multiple-choice-survey-answers\n","scope":"contextual","trigger_keywords":["Count multi-select survey answers","count-multiple-choice-survey-answers","count multiple choice survey answers","How do I count a survey question where people could tick more than one box?","How do I count a survey question where people could tick more than one box","multiple-response survey","count checkbox responses","multiple-select survey"],"is_private":true,"is_active":true,"scripts":[{"name":"count-multiple-choice-survey-answers-check","description":"Compare a saved JSON answer with a published test. Pass tests\/case-1\/expected.json (or another case) and the path to your answer.","language":"python","filename":"count-multiple-choice-survey-answers-check.py","content":"from pathlib import Path\nimport runpy\n\nrunpy.run_path(str(Path(__file__).parent \/ 'tests' \/ 'check.py'), run_name='__main__')\n","supporting_files":[{"path":"SKILL.md","content":"---\nname: count-multiple-choice-survey-answers\ndescription: \"Count multi-select (tick all that apply) survey answers per option with the right base: respondents who answered, not selections or invitees, handling skips, None and contradictory answers. Use when summarising checkbox questions from a survey export or results spreadsheet.\"\nlicense: CC-BY-4.0\nmetadata:\n  author: Raq.com\n  version: \"2026-11-22\"\n  homepage: https:\/\/skills.raq.com\/skills\/count-multiple-choice-survey-answers\n---\n\n# Count multi-select survey answers\n\nReport how many respondents chose each option, with an explicit denominator for a question that allowed several choices.\n\n## When to use this skill\n\n- A survey question let people tick more than one option and someone wants counts and percentages.\n- The export mixes skipped answers, people routed past the question and people who never responded.\n- The option percentages add up to more than 100% and someone wants to know whether that is right.\n\n## When not to use it\n\n- Weighting results to a population or testing whether differences between groups are significant. That needs the survey's design weights and a statistical method.\n- Coding free-text Other answers into themes. Count them as Other and code the text separately.\n\n## What you need\n\n- Question wording, valid choices in display order, and the answer recorded for each respondent.\n- Skip logic, missing-answer codes, and whether an explicit None is an allowed response.\n\n## Ask before you start\n\nIf any of these are missing or unclear, ask before doing the work.\n\n- What was the exact question and its options in order, including any None or Don't know option, and is that option exclusive?\n- Who was asked the question? Routing or skip logic decides who belongs in the base.\n- How does the export record a skipped question, a person routed past it and an invitee who never started?\n\n## Method\n\n1. Define the question-level base from the survey routing and response-status records. Separate recorded item skips from people routed past the question and invitees who never responded. If the export cannot make that distinction, say so.\n2. Split each answer using the export's documented encoding and remove a choice repeated within one person's answer. Count an explicit None as an answered question if it was offered.\n3. Hold for review any answer that combines an exclusive option such as None with another option. Leave it out of the base and the option counts until it is resolved.\n4. For each listed option, count the distinct valid respondents who selected it. Divide by the number of eligible respondents who answered. A base of zero gives no percentage.\n5. Round each percentage to one decimal place only after dividing, and do not force the percentages to total 100%.\n6. Report the base, the skipped count and the percentages together, and list the responses held for review.\n\n## Checks before you deliver\n\n- Percent of selections uses a different denominator. Labelling it as percent of people misstates the result.\n- Percentages of respondents can sum to more than 100 when people select several options.\n- Including invitees who never started, or people routed past the question, in the base.\n- Treating a blank as None. An explicit None is an answer; a blank is a skip.\n- Counting an option twice when the export repeats it within one answer.\n\n## How to present the result\n\nLead with the base: how many eligible people answered, how many skipped, and that several choices were allowed. Then give a table in the questionnaire's option order with the count and percent of respondents for each. List any responses held for review and why, and note that the percentages can total more than 100%.\n\n## Worked example\n\n**Request:** Summarise valid respondents. Allowed choices in order: Talks, Walks, None. A dash is blank.\n\n**Supplied material:**\n\n```text\nid|eligible|choices\nA|yes|Talks;Walks\nB|yes|Walks;Walks\nC|no|-\nD|yes|-\nE|yes|None\n```\n\n**Answer:** Of three valid respondents, one selected Talks (33.3%), two selected Walks (66.7%) and one selected None (33.3%). One eligible person skipped the question. Multiple selections were allowed.\n\n## Structured output for tests\n\nFor an ordinary job, answer in the format above and point back to the supplied evidence. Use this structure only for the test cases published with this skill, or when someone asks for structured JSON.\n\nReturn answered and skipped as counts of eligible valid answers and eligible blank answers; review as respondent IDs needing clarification; options as objects with option, count and percent in supplied choice order. Exclude review cases from both counts. Round percent to one decimal or use null for a zero base.\n\n## Sources\n\n- [SurveyMonkey: checkboxes question](https:\/\/help.surveymonkey.com\/en\/surveymonkey\/create\/checkbox\/): SurveyMonkey explains that response percentages for a checkbox question may exceed 100% because the total number of choices selected can be greater than the number of people who answered.\n- [US Census Bureau: item nonresponse rates](https:\/\/www.census.gov\/newsroom\/blogs\/random-samplings\/2021\/08\/2020-census-operational-quality-metrics-item-nonresponse-rates.html): The Census Bureau defines item nonresponse as a respondent giving some information but not answering every question, and unit nonresponse as no response at all from an address. The skill keeps item skips and nonrespondents apart for the same reason.\n\nTest cases and an answer checker for this skill: https:\/\/skills.raq.com\/skills\/count-multiple-choice-survey-answers\n"},{"path":"LICENSE.txt","content":"Original Raq.com instructions and synthetic examples: CC BY 4.0.\nhttps:\/\/creativecommons.org\/licenses\/by\/4.0\/\nAttribution: Raq.com, https:\/\/skills.raq.com\/skills\/count-multiple-choice-survey-answers\nReferenced third-party materials retain their own terms.\n"},{"path":"examples\/worked-example.md","content":"# Events people attend\n\nSummarise valid respondents. Allowed choices in order: Talks, Walks, None. A dash is blank.\n\n## Supplied material\n\nid|eligible|choices\nA|yes|Talks;Walks\nB|yes|Walks;Walks\nC|no|-\nD|yes|-\nE|yes|None\n\n## Worked answer\n\nOf three valid respondents, one selected Talks (33.3%), two selected Walks (66.7%) and one selected None (33.3%). One eligible person skipped the question. Multiple selections were allowed.\n\n## Reasoning\n\nThe duplicate Walks selection counts once. The explicitly selected None contributes to the base.\n"},{"path":"tests\/check.py","content":"\"\"\"Check a saved agent answer locally with Python 3 (standard library only).\"\"\"\nimport json\nimport math\nimport sys\nfrom pathlib import Path\n\n\ndef compare(expected, actual, path=\"$\", accepted=None):\n    if isinstance(expected, bool) or isinstance(actual, bool):\n        if expected is not actual:\n            yield path\n    elif isinstance(expected, (int, float)) and isinstance(actual, (int, float)):\n        if not math.isclose(expected, actual, rel_tol=0, abs_tol=1e-8):\n            yield path\n    elif isinstance(expected, dict) and isinstance(actual, dict):\n        for key in sorted(set(expected) | set(actual)):\n            if key not in expected or key not in actual:\n                yield f\"{path}.{key}\"\n            elif not any(\n                not list(compare(option, actual[key]))\n                for option in (accepted or {}).get(key, [])\n            ):\n                yield from compare(expected[key], actual[key], f\"{path}.{key}\")\n    elif isinstance(expected, list) and isinstance(actual, list):\n        if len(expected) != len(actual):\n            yield f\"{path} (length)\"\n        for i, (left, right) in enumerate(zip(expected, actual)):\n            yield from compare(left, right, f\"{path}[{i}]\")\n    elif type(expected) != type(actual) or expected != actual:\n        yield path\n\n\ndef main():\n    if len(sys.argv) != 3:\n        raise SystemExit(\"Usage: python3 check.py expected.json answer.json\")\n    try:\n        expected, actual = [json.loads(Path(p).read_text(encoding=\"utf-8\")) for p in sys.argv[1:]]\n        alternatives = Path(sys.argv[1]).with_name(\"accepted.json\")\n        accepted = json.loads(alternatives.read_text(encoding=\"utf-8\")) if alternatives.is_file() else {}\n    except (ValueError, OSError) as error:\n        raise SystemExit(str(error))\n    differences = list(compare(expected, actual, accepted=accepted))\n    if differences:\n        raise SystemExit(\"Different fields: \" + \", \".join(differences))\n    print(\"Pass\")\n\n\nif __name__ == \"__main__\":\n    main()\n"},{"path":"tests\/README.md","content":"Give your agent SKILL.md and one request.txt in a fresh session. Keep the expected answer aside. Save the reply as answer.json, then run this from the tests folder:\n\n    python3 check.py case-1\/expected.json answer.json\n\nEach case also has an explanation. Where accepted.json exists, the checker accepts the alternatives listed there.\n"},{"path":"tests\/case-1\/request.txt","content":"Summarise valid respondents. Allowed choices in order: Talks, Walks, None. A dash is blank.\nReturn only the JSON specified in SKILL.md for this test.\n\nid|eligible|choices\nA|yes|Talks;Walks\nB|yes|Walks;Walks\nC|no|-\nD|yes|-\nE|yes|None\n"},{"path":"tests\/case-1\/expected.json","content":"{\n    \"answered\": 3,\n    \"skipped\": 1,\n    \"review\": [],\n    \"options\": [\n        {\n            \"option\": \"Talks\",\n            \"count\": 1,\n            \"percent\": 33.3\n        },\n        {\n            \"option\": \"Walks\",\n            \"count\": 2,\n            \"percent\": 66.7\n        },\n        {\n            \"option\": \"None\",\n            \"count\": 1,\n            \"percent\": 33.3\n        }\n    ]\n}\n"},{"path":"tests\/case-1\/explanation.txt","content":"The duplicate Walks selection counts once. The explicitly selected None contributes to the base.\n"},{"path":"tests\/case-2\/request.txt","content":"Summarise responses. Allowed choices in order: Cycle, None. A dash is blank.\nReturn only the JSON specified in SKILL.md for this test.\n\nid|eligible|choices\nP1|yes|None;Cycle\nP2|yes|-\n"},{"path":"tests\/case-2\/expected.json","content":"{\n    \"answered\": 0,\n    \"skipped\": 1,\n    \"review\": [\n        \"P1\"\n    ],\n    \"options\": [\n        {\n            \"option\": \"Cycle\",\n            \"count\": 0,\n            \"percent\": null\n        },\n        {\n            \"option\": \"None\",\n            \"count\": 0,\n            \"percent\": null\n        }\n    ]\n}\n"},{"path":"tests\/case-2\/explanation.txt","content":"There is no valid denominator until the contradictory response is resolved.\n"},{"path":"tests\/case-3\/request.txt","content":"Summarise Red, Blue and None for respondents who reached this question. None is exclusive.\nReturn only the JSON specified in SKILL.md for this test.\n\nA reached: Red;Red;Blue\nB reached: None;Blue\nC reached: explicitly skipped\nD reached: Red\nE eligible invitee, never started the survey\n"},{"path":"tests\/case-3\/expected.json","content":"{\n    \"answered\": 2,\n    \"skipped\": 1,\n    \"review\": [\n        \"B\"\n    ],\n    \"options\": [\n        {\n            \"option\": \"Red\",\n            \"count\": 2,\n            \"percent\": 100\n        },\n        {\n            \"option\": \"Blue\",\n            \"count\": 1,\n            \"percent\": 50\n        },\n        {\n            \"option\": \"None\",\n            \"count\": 0,\n            \"percent\": 0\n        }\n    ]\n}\n"},{"path":"tests\/case-3\/explanation.txt","content":"Only C is a recorded item skip. B needs review, and E supplied no questionnaire. Neither belongs in the two-person percentage denominator.\n"}],"is_active":true,"is_approved":false}]}]}