1/2/17
7:59 am

# Randomly Shuffle Rows In Numbers

You can sort rows in Numbers using a trick with the rand function. You can also sort or shuffle a single column by copying that column to another table, performing the sort, and then copying it back to the original table.

Video Transcript (Click to Expand)
In Numbers it's easy to sort something alphabetically or numerically. You can click on the column head here and say Sort right there and sort either column. But what if you wanted to do it randomly? You wanted a random order. Say you're a teacher and you wanted to meet with students about their grades in a random order.

You can do that as well but you have to use a trick to do it. So to do this trick I'm going to add another column here. I'm going to drag this out to add a third column here. Then I'm going to put a formula in here. I'm going to, Equals and use the formula RAND. What RAND does is it simply puts a random number between zero and one. So it's a fraction. See it right there.

I'm going to Copy and I'm going to Paste it into this whole range. So since it's a random number you can see every single cell contains a different random number. Now what I need to do is Sort by this column. You can see it sorts the entire table starting with the lowest random number here to the highest one giving me a random shuffle of everybody there keeping their name and their grade together. So now I have a random order.

Now let's look an another example. In Sheet 2 here I've got all the people in the class and I've got an assignment for them to bring to the picnic. Now if I were to randomly sort these the same way they would actually keep all of the information together. So, for instance, John would always bring drinks because these two cells would always be sorted together.

What you need to do is you need to actually just sort this one column. The way to do that in Numbers is you have to create another table. So what I'm going to do here is I'm actually going to duplicate this table by Option dragging it, you can see I've created another version of that same table. I'm going to replace the names with the RAND function. There. I'm going to Copy and Paste it. Then I'm going to Sort. That sorts everything here on the right. Then I'm going to Copy and select the same range and Paste.

Now I've copied this range over here, pasted it here, and now everybody has a random assignment for what to bring to the picnic.