Basic for-loop statement in Excel - retrieve & display multiple index-values in ODK Collect?

Good morning,

Is it possible to create a basic for-loop concept in Excel before being
converted to XForms?

My current situation is:

With a created repeat-group, the user is able set several index-values for
the fieldname, each time the user is prompted with "Add a new group"

Now, should I want to display for example the second [2] index in
ODKCollect, that is: fieldname[2], it is quite simple with:
indexed-repeat(${fieldname}, ${groupname},2)

However, if the user had set up 4 different values after adding 4 groups,
how should I go about in order to display all of them, before the user
exits the form?
That is, how can I set-up Excel in order to display the following in ODK
Collect:

fieldname[1]
fieldname[2]
fieldname[3]
fieldname[4]

With a basic for-statement I would go about the following:
(below does not relate to a specific programming language - the purpose is
only to portray the concept that wants to be done
)

i = 1;
for i <= count({groupname})
indexed-repeat(${fieldname}, ${groupname},i);
i = i +1;
end;

Thank you,