Max integer from repeat group

Hello all,
I hope you all are doing good,

I have tried many times but couldn’t do this.

I have an integer question (Question 2) inside a repeated group. I know how many times the repeated group will be repeated (repeat_count) is based to an answer of Questio1.

Let’s say that the number of repeated group will be 6, and the Question 2 (which is inside the repeat) has the follow answers:
6 / 5 / 11 / 3 / 15 / 1

so my question is:

Is there a way to know the max value (input) had be entered to the Question 2 (from all over the 6 repeats) ? (which is 15 in this situation)


Welcome @musto ,
Please see the attached image

1 Like

Thank you so much dear @MohammedTaleb .

I will try ASAP.

Can I add another condition?

I will add Question3 as select one yes/no and this question will be inside the repetition.

How can I say (outside the repetition),

Find the Max value of Question 2 with (Yes) response to Question 3, if the max value repeat has answer (no) to Question 3, then find the the next Max value with answer Yes to Q3 if not then keep looking till you find max with yes and once you find the max value with Yes response give the repeat index :slight_smile:

Sorry for such confusion if there is any. Your help much appreciated.

1 Like

:heart_eyes: :+1:


Thank you again, but how I can identify the index number of that max value repetition?

1 Like

Excuse me @musto I am sorry
I didn’t notice that you also wanted the index of maximum value

The attached file contains the required

first solution.xlsx (10.7 KB)
best solution.xlsx (10.8 KB)


Dear no need to be sorry at all, YOU ROCK!

Here is the issue and the solution for the community, credit to @MohammedTaleb with namy thanks.

The issue:
We need to know the eldest child’s age and gender from a repeated group, so we can force the entries in later group to be exactly the same as the entries in the repition.

The count of the repition based on an integer answer.
The age question inside the repition is >= 3 and <= 22.
The gender select one only male and female
There is a question if there is a disability or not.

The later group of questions is asking for the eldest child in the 5-17 age segmentation with no disability.

For quality control, we have to extract the eldest child age and gender if there is no disability. If the eldest child has a disability then we move to the next eldest one.

The solution:

In the file attached after I did a slight change to it from the orginal file solved by @MohammedTaleb in this post:

Thank you Mohammed and thanks to the community!

best solution.xlsx (11.0 KB)


First of all, your contribution to this community is highly appreciated, you’re a lifesaver @MohammedTaleb
Now, i have an exact same scenario but besides of pulling the index corresponding to the maximun value, i’d like to pull also a text string (lets say first name).
Attached youll find teh best solution file, but with a tiny modification. i add a text variable for name.
Could you take a look and share your ideas on how to do this. or better could you point me to some resource where i can learn (an more inmportante, understand) how the index-repeat + position(…) works togheter.

Thanks in advanace and please receive my best regards and appreciation from Guatemala.


ps: Here the file: best solution-01Dec22.xlsx (10.9 KB)

Salam Mohamed, could you please explain the difference between both methods. I don’t understand how it works in both cases but they are different in the sense of that extra repeat section. If you could provide just some clarity would be very helpful. The solution in itself is great, and would like to thank you so much for your contribution! :slight_smile: