Folks question from a Coda noob: I’m trying to shuffle a column in a Table. Any suggestions on the best way to do this.
I am trying to set up 1:1 meetings between a set of people that are matched at random. I have table where Column A has all the user names and in Column B I would like to take this list, shuffle it and match them up with usernames in Column A.
Column B will be type Lookup, to this table (let’s call the table People)
First, we can add a column (we’ll call it RandomNumber) with formula Random() to give everyone a random number (we’ll use this for sorting everyone in a random order).
We can also add a column (we’ll call it MyNumber) with formula [People].Find(thisRow), which will spit out a row number (see more about that here)
Then we need to choose our match for each person.
A basic approach would look like this for the Column B formula:
grab one of the names from the list. which name? if I’m the person in row #4, select the 4th person in the randomized list
This still has some problems though, for example that you can get matched with yourself. You need to finagle a .Filter( currentValue != thisRow ) in there somewhere, but it’s gonna throw off your position numbering. Can someone step in to finish this bit off?
I’ve added a demo doc outlining some other applications - e.g. if you want a true shuffle of a list (vs matchups like this), it includes formulas for that