Hello all!

I’m trying to figure out if (ideally) it is possible to design the following sequence using Builder and Excel alone, or (perhaps less ideally) with a bit of Python.

In brief, the experiment is a super-simple repeated measures 2x2 factorial design, with each trial containing two stimuli corresponding to the two factors.

i.e. there are 2 factors (say I and II), each with 2 conditions (say A vs B for I, and C vs D for II), for a total of 4 cells (say 1, 2, 3 and 4). So the cells would be:

```
I II
1 A C
2 A D
3 B C
4 B D
```

The stimuli for each condition have a number of instances - say, 40 different instances of each of conditions A, B, C and D - corresponding to image files that can be specified in an excel spreadsheet.

What I would ideally like is, on each trial, the cell is randomly selected (i.e. 1, 2, 3 or 4), AND the instance of the stimuli is randomly selected (i.e. if cell 1, then randomly select one of A and randomly select one of C). BUT I then don’t want that particular instance of A or C to ever repeat again (i.e. in *any* cell - all individual instances should be non-repeating).

(Note, I also need equal numbers of each cell to appear across the experiment, i.e. with 40 instances of each condition for a total of 160 trials, each cell-type should thus also appear 40 times.)

So far, I’ve only been able to quasi-randomly program the sequence by having all images files specified in columns in the spreadsheet, with the instances of each condition arbitrarily paired in the rows - i.e. the random function in Builder randomly selects a line in the spreadsheet (so I have random *cell* selection). But if I do it this way, for every participant, a particular instance of A is always paired with a particular instance of C (and so on) - so obviously, it’s not truly random.

Is it possible to randomly select (without replacement) each instance of each condition, perhaps using spreadsheets that define the conditions of cells which themselves refer to lists in other spreadsheets?

(Kind of like the “images block” demo, where a spreadsheet defines the 2 blocks that reference lists in other spreadsheets - but note, I am NOT using a blocked design, i.e. the cells are randomly presented through the experiment according to 1 trial loop.)

Sorry in advance if this is achieved by some obvious simple logic that I’ve yet to figure out!

Cheers