# Counting household members below 5 years in a repeat group

Hi ODKers,

I am developing a survey tool to collect details of household members such
as name, age, education and gender.

I have used a repeat to help in looping. So the 1st question is "How many
persons live in this household?" If the response is 5 for example, it loops
five times to allow entry of each of the 5 members of the household.

Now I want the system to check ages of all household members entered and
report the number with age below 5 years old. This could be in a note: You
have ___ persons below the age of 5 in this household.

Any advice on how to approach it in Xlsform form would be highly
appreciated.

Regards.

Collins

Hi, Collins,
I just used the following several times to get the results similar to what you want:

1. in the row following the age,
name ="cu5" or any name, calculation ="if(\${age} <=5, 1, 0)
2. in the row following your "end repeat"
name = "sumcu15", calculation = "sum(\${cu5})
3. in the row following
note, label ="You have \${sumcu5} persons below the age of 5 in this household.

try if it works for you

Zaixing

1 Like

Thank you so much Zaixing, its working.

God bless.

Collins

··· On Thu, May 22, 2014 at 1:52 PM, wrote:

Hi, Collins,
I just used the following several times to get the results similar to what
you want:

1. in the row following the age,
name ="cu5" or any name, calculation ="if(\${age} <=5, 1, 0)
2. in the row following your "end repeat"
name = "sumcu15", calculation = "sum(\${cu5})
3. in the row following
note, label ="You have \${sumcu5} persons below the age of 5 in this
household.

try if it works for you

Zaixing

## --

You received this message because you are subscribed to the Google Groups
"ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send an