# Setting up randomization between participants

**URL:** <https://discourse.psychopy.org/t/setting-up-randomization-between-participants/40512>\
**Category:** Builder\
**Created:** [June 20, 2024, 7:10pm UTC](https://discourse.psychopy.org/t/setting-up-randomization-between-participants/40512 "2024-06-20T19:10:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jpilato](https://avatars.discourse-cdn.com/v4/letter/j/58956e/32.png) [@jpilato](https://discourse.psychopy.org/u/jpilato)\
**Post date:** [June 20, 2024, 7:10pm UTC](https://discourse.psychopy.org/t/setting-up-randomization-between-participants/40512/1 "2024-06-20T19:10:36Z")

</div>

Hello,

I am trying to set up my experiment so that a participant randomly gets assigned to one of four groups. The order of the stimuli is different for each group so i have different excel files for each group. I have set up the outer loop to go to an excel sheet to randomly select a group (conditions) sheet but the problem i am running into is that it is going through all 4 groups and i only want it to show one excel file per participant (not all 4 in a random order). I have it set to repeat once but i am still running into the problem where it is going through all 4 condition excel files. Is it because my outer loop is not set up correctly? This experiment needs to be uploaded to pavlova as well. Any information would be greatly appreciated.

 ![Screenshot 2024-06-20 150643](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/b/8/b898ee8a366d429ef9e72ff3ad7099dc1441be4c.png)

---

<div class="post-metadata">

**Author:** ![JensBoelte](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/jensboelte/32/9060_2.png) [@JensBoelte](https://discourse.psychopy.org/u/JensBoelte)\
**Post date:** [June 21, 2024, 7:11am UTC](https://discourse.psychopy.org/t/setting-up-randomization-between-participants/40512/2 "2024-06-21T07:11:17Z")

</div>

Hello

I am not quite sure that I have understood the way you have set up the randomisation. If I interpreted it correctly, you could use the **Selected rows** option. Setting it to 1 would select the first row of your Excel file.

Best wishes, jens

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [June 21, 2024, 9:28am UTC](https://discourse.psychopy.org/t/setting-up-randomization-between-participants/40512/3 "2024-06-21T09:28:17Z")

</div>

The simplest modification based on what you’ve done so far would be to add a code component to one of your routines inside the condition\_files loop and add the code `condition_files.finished=True` so that the loop only runs once instead of once per condition.

This should randomly select a group, which means that your group sizes won’t be equal. For that you need counterbalancing (either with a [counterbalance routine](https://psychopy.org/builder/components/counterbalanceComponent.html) or the [VESPR Study Portal](https://moryscarter.com/vespr/portal/admin/) or [Participant IDs for Pavlovia](https://moryscarter.com/vespr/pavlovia.php)). I would currently recommend waiting until the 2024.2.0 release before using the counterbalance routine for 4 groups online. I’ve had and seen some issues with it.
