# Automate a question response based on answers from a previous questions

**URL:** <https://forum.getodk.org/t/automate-a-question-response-based-on-answers-from-a-previous-questions/38548>\
**Category:** Support\
**Tags:** odk-xlsform\
**Created:** [August 3, 2022, 5:05pm UTC](https://forum.getodk.org/t/automate-a-question-response-based-on-answers-from-a-previous-questions/38548 "2022-08-03T17:05:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adilson\_Bauhofer](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/adilson_bauhofer/32/18765_2.png) [@Adilson\_Bauhofer](https://forum.getodk.org/u/Adilson_Bauhofer)\
**Post date:** [August 3, 2022, 5:05pm UTC](https://forum.getodk.org/t/automate-a-question-response-based-on-answers-from-a-previous-questions/38548/1 "2022-08-03T17:05:10Z")

</div>

Hi everyone

I have a question, and I'm using Open Data Kit XLS form

I'm setting a form to assess participant eligibility based on the responses of three questions for a follow-up at two different sites:

Q1. Participant older than 18? Responses: yes/no  
Q2. Participant school-level education? Responses: None/Primary/Secondary  
Q3. Participant country of residence? Responses: Mozambique/Tanzania/South Africa

I want to Q4 to be a read\_only and provide the following options if a set of statements are met:

Q4. Is the participant eligible and if yes to which site?  
Response 1: Eligible to Mozambique (if (Q1 = 'yes' and Q2 = 'Primary' or 'Secondary' and Q3 = 'Mozambique'))  
Response 2: Eligible to South Africa (if (Q1 = 'yes' and Q2 = 'Primary' or 'Secondary' and Q3 = 'South Africa'))  
Response 3: Not eligible (if (Response 1 or Response 2 = FALSE))

Sorry for not having a script, not sure how to code the if() statements

---

<div class="post-metadata">

**Author:** ![danbjoseph](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/danbjoseph/32/21901_2.png) [@danbjoseph](https://forum.getodk.org/u/danbjoseph)\
**Post date:** [August 4, 2022, 1:38pm UTC](https://forum.getodk.org/t/automate-a-question-response-based-on-answers-from-a-previous-questions/38548/2 "2022-08-04T13:38:20Z")

</div>

Welcome to the ODK forum, @Adilson_Bauhofer! We're glad you're here. When you get a chance, please [introduce yourself on this forum thread](https://forum.getodk.org/t/-/6671). I'd also encourage you to add an image as your avatar because it helps build community!

I would use a [`calculate`](https://xlsform.org/en/#calculation) type question to determine if the person is eligible, and then use the results of that calculation to show the correct note about their eligibility.

Here's an example: [bauhofer\_example.xlsx](https://forum.getodk.org/uploads/short-url/lxH0sFu6QA9C4vcVGn34NPZvlB3.xlsx) (10.1 KB)

---

<div class="post-metadata">

**Author:** ![Adilson\_Bauhofer](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/adilson_bauhofer/32/18765_2.png) [@Adilson\_Bauhofer](https://forum.getodk.org/u/Adilson_Bauhofer)\
**Post date:** [November 14, 2022, 12:00pm UTC](https://forum.getodk.org/t/automate-a-question-response-based-on-answers-from-a-previous-questions/38548/3 "2022-11-14T12:00:59Z")

</div>

Thank you @danbjoseph truly helped
