I need help on selection/randomisation

Dear Good People, Am from Uganda and learning how to programme ODK using Xlsform.
i need help on this situation.
i am asking a parent to tell me all the children he/she has aged 2 years to 17 years. However, if a parent has any child between the ages of 10-14 years i.e (10, 11, 12, 13, 14), the tablet should prioritize selecting that child otherwise, the tablet should select other child in the age bracket.
e.g parent has children aged 3, 6 8 13, 7. the tablet should select age 13.

i have uploaded what i have done so far but i dont know where to insert my criteria
Book1.xlsx (11.4 KB)

Hi @KajosUg
We're glad you're here. When you get a chance, please introduce yourself on this forum thread. I'd also encourage you to add a real picture as your avatar because it helps build community!

so you want to collect data about all children let's say there are 5 of them and then choose just one randomly but if there are children aged 10-14 they should be prioritized and only one of them should be selected?
Is that what you need or maybe I don't understand something?

Dear Grzesiek2010,

Sorry for this late reply. i have been very sick. Yes, what you wrote is what i need. Any help?