Random sort in Excel: shuffle cells, rows and columns

The tutorial will teach you two quick ways to randomize in Excel: perform random sort with formulas and shuffle data by using a special tool.

Microsoft Excel provides a handful of different sorting options including ascending or descending order, by color or icon, as well as custom sort. However, it lacks one important feature - random sort. This functionality would come in handy in situations when you need to randomize data, say, for an unbiased assigning of tasks, allocation of shifts, or picking a lottery winner. This tutorial will teach you a couple of easy ways to do random sort in Excel.

How to randomize a list in Excel with a formula

Although there is no native function to perform random sort in Excel, there is a function to generate random numbers (Excel RAND function) and we are going to use it.

Assuming you have a list of names in column A, please follow these steps to randomize your list:

  1. Insert a new column next to the list of names you want to randomize. If your dataset consists of a single column, skip this step.
  2. In the first cell of the inserted column, enter the RAND formula: =RAND()
  3. Copy the formula down the column. The fastest way to do this is by double-clicking the fill handle:
    Excel RAND formula
  4. Sort the column filled with random numbers in ascending order (descending sort would move the column headers at the bottom of the table, you definitely don't want this). So, select any number in column B, go to the Home tab > Editing group and click Sort & Filter > Sort Largest to Smallest.
    Sort the column filled with random numbers in ascending order.
    Or, you can go to the Data tab > Sort & Filter group, and click the ZA button sort ascending.

Either way, Excel automatically expands the selection and sorts the names in column A as well:
Names are sorted in random order.

Tips & notes:

  • Excel RAND is a volatile function, meaning that new random numbers are generated every time the worksheet is recalculated. So, if you are not happy with how your list has been randomized, keep hitting the sort button until you get the desired result.
  • To prevent the random numbers from recalculating with every change you make to the worksheet, copy the random numbers, and then paste them as values by using the Paste Special feature. Or, simply delete the column with the RAND formula if you don't need it any longer.
  • The same approach can be used to randomize multiple columns. To have it done, place two or more columns side by side so that the columns are contiguous, and then perform the above steps.

How to shuffle data in Excel with Ultimate Suite

If you don't have time to fiddle with formulas, use the Shuffle Cells tool included in our Ultimate Suite for Excel to do a random sort faster.

  1. Head over to the Ablebits Tools tab > Utilities group, click the Randomize button, and then click Shuffle Cells.
    Shuffle Cells tool in Excel
  2. The Shuffle pane will appear on the left side of your workbook. You select the range where you want to shuffle data, and then choose one of the following options:
    • Cells in each row - shuffle cells in each row individually.
    • Cells in each column - randomly sort cells in each column.
    • Entire rows - shuffle rows in the selected range.
    • Entire columns - randomize the order of columns in the range.
    • All cells in the range - randomize all cells in the selected range.
  3. Click the Shuffle button.

In this example, we need to shuffle cells in column A, so we go with the third option:
Shuffle cells in the selected columns.

And voilà, our list of names is randomized in no time:
A list of names is randomized.

If you are curious to try this and explore a lot more fascinating features included with Ultimate Suite for Excel, you are welcome to download a 14-day trial version.

You may also be interested in

Category: Excel Tips

Table of contents

15 responses to "Random sort in Excel: shuffle cells, rows and columns"

  1. Jenn says:

    Thank you so much! I knew there had to be a way to randomize a list in Excel. I never would have come up with this on my own!

  2. bob says:

    the running ticker at the bottom of the site is incredibly distracting and makes it almost unusable. I use it ONLY if I can't find the answer on another site.

  3. Mohammad says:

    Hello
    Thank you. that was creatively. I enjoyed it.

  4. Kelly says:

    I do circuit training routines at home. I have multiple exercises that I perform, and I'm currently looking through a list on a Word document, and just picking as I go. I would like for Excel to choose the exercises randomly for me. I have multiple columns of exercises, once column for each part of the body it works. Is it possible to open the spreadsheet, and Excel will automatically highlight several random cells out of each column? And each time I open it, Excel will choose a different set of random cells to automatically highlight out of each column? I am not well-versed in formulas, and was unable to make the multiple column thing work for me.

    Thanks for any advice or help you can give.

    Kelly

  5. manik says:

    thanks a lot you saved my job. i had to plan a tambola, and was easily able to generate 45 tickets with the help of the randomise > shuffle cells tool from Utilitites.
    I have been trying so hard from =Rand() formula, but it never worked multiple combinations.
    Thanks a lot.

  6. Lorne says:

    Brilliant! Your instructions worked perfectly, giving me a way to instantly randomize a list of names as often as I want. No way can anyone stumble upon this solution without in depth knowledge of Excel. Sincere thanks!

  7. Ken says:

    I need a computer/randomizer program for a volleyball tournament that shuffles 36 players to play or sit out within 12 games.

    1) We have 2 volleyball courts, 4 sides (Red & Green; Yellow & Blue).
    2) We have 36 players. 6 teams of 6 players per team. 24 players would play on 4 teams on the 2 courts for each game. 12 players would sit out each game. Each team will consist of 6 different players each game.
    3) Each player would have a number and would play on the team and court color each game.
    4) There would be a total of 12 games. Each player would play 8 and sit out 4 of the 12 games. Each player will play twice on each court color. No player will play more than 2 games in a row.
    5) With 36 players, 1 player would play 8 games with 5 other players each game.

    We would also like to have the program sort for: 36 players (6 teams of 6 players per team); 30 players (6 teams of 5 players per team); 24 players (6 teams of 4 players per team); 24 players (4 teams of 6 players per team); 20 players (4 teams of 5 players per team) and 16 players (4 teams of 4 players per team).

    I would like the program to be able to run on a laptop computer.
    Thanks for you assistance or comments.

  8. Tom Hickey says:

    I have a complicated spreadsheet in which I use iteration=1 to deal with an intentional circular reference. I use the RAND() function, and manual recalculation. I use COUNTIF to determine the sort sequence of the random numbers. I then use OFFSET and MATCH together to extract the data in the new randomized order.

    For reasons that are too complicated for this format, I want to retrieve first one column on one manual recalculation and then that column plus a second (without resorting the original list) on the next recalculation - hence the circular equations

    What's happening is that the COUNTIF function appears to be working on the random numbers before all of the random numbers have been calculated as the values returned are clearly wrong.

    I’m assuming there’s some interaction between iteration, RAND() and the Excel’s calculation sequencing that is causing the problems but I have been unable to work out a solution.

    Any ideas?

    • Hello!
      Unfortunately, without seeing your data it is difficult to give you any advice.
      I guess the reason is that the random data changes with each recalculation.

      • Tom says:

        That's been my thought too.

        I read Excel's description of how it determines the calculation order of cells so I tried linking the calculation of the COUNTIF function to the cell containing the random number so that a recalculation of the COUNTIF is tied to the last iteration's random number. This hasn't solved the problem, though.

        Do you know of a way to force the Excel's calculation tree to calculate specific cells in a particular order?

        I am willing to send you the spreadsheet if you are interested in digging into the situation more deeply.

  9. John says:

    Google randomization is a lot easier and user friendly.

Post a comment



Thank you for your comment! When posting a question, please be very clear and concise. This will help us provide a quick and relevant solution to your query. We cannot guarantee that we will answer every question, but we'll do our best :)