# Variable Auto assignment

**URL:** <https://forum.odk-x.org/t/variable-auto-assignment/1379>\
**Category:** Support\
**Tags:** odk-x-survey\
**Created:** [May 25, 2021, 12:42pm UTC](https://forum.odk-x.org/t/variable-auto-assignment/1379 "2021-05-25T12:42:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![James\_Nyanga](https://odkx.b-cdn.net/user_avatar/forum.odk-x.org/james_nyanga/32/451_2.png) [@James\_Nyanga](https://forum.odk-x.org/u/James_Nyanga)\
**Post date:** [May 25, 2021, 12:42pm UTC](https://forum.odk-x.org/t/variable-auto-assignment/1379/1 "2021-05-25T12:42:32Z")

</div>

Hi team, Just a quick question. Is it possible to assign variables automatically in a survey? Lets say, I have a select\_multiple question and the variable under it is COVID1. So when I choose 3 selections in that question, It should automatically generate 3 variables that stores the data i.e. COVID1\_1,COVID1\_2 & COVID1\_3 instead of storing it in one variable(COVID1) as an array like [“1”,“2”,“3”].

Thanks

---

<div class="post-metadata">

**Author:** ![elmps2018](https://odkx.b-cdn.net/user_avatar/forum.odk-x.org/elmps2018/32/105_2.png) [@elmps2018](https://forum.odk-x.org/u/elmps2018)\
**Post date:** [May 25, 2021, 1:58pm UTC](https://forum.odk-x.org/t/variable-auto-assignment/1379/2 "2021-05-25T13:58:02Z")

</div>

Hi @James_Nyanga! It’s certainly possible for you to set up your survey to do this although I don’t think there’s a one line sort of solution. You can define COVID1\_1 COVID1\_2 and COVID1\_3 in your model statement and then “assign” them with the [assign prompt type](https://docs.odk-x.org/xlsx-converter-reference/#survey-prompt-types) and a calculation. You can wrap the assign in an “if” using a [selected](https://docs.odk-x.org/xlsx-converter-reference/#available-calculates-functions) calculation
