Want to automatically group integer values as part of a calculate function

Hi all,

I am currently writing a form that is linked to the Food Consumption Score Nutritional Quality Analysis (FCS-N).

Currently asking households over the last 7 days how many vegetables, eggs, meat, etc they have eaten. The answers come out as values 0-7.

Is there a way to automatically group these values into 3 groups? Never = 0 eaten (output variable = 1), Sometimes 1-6 (output variable = 2) and At least daily = (output variable = 3)

This would be helpful to then input a calculate function to observe the protein, hem iron and Vit A outcomes of this population.

Thanks for your time all and appreciate the amazing support,
Ben

Hi buddy, sadly you can't do so. Try responding manually!

Regards,
Seder Smith

The best is to use a "calculate" question and do something like if(${question_name} = 0, 1, if(${question_name} >= 7, 3, 2))

https://xlsform.org/en/#calculation

Note that this calculation will happen in the background and not be automatically displayed on the screen.

Hi @noel_cartong

Thanks for passing on that information, the calculate and if functions work perfectly,

Cheers,
Ben