Sorting a list of items in random order in excel – using formulas

Analytics , Learn Excel - 11 comments

In shuffling a list of items in excel I have described the technique of using random numbers generated by RAND() to sort a list of items. The technique had one disadvantage though, every time you need to reshuffle the list you have to press F9 to recalculate the rand() and then go to menu > data > sort and sort the data again based on the new random numbers.

shuffling-list-of-items-excel-formulasHere is a better technique that needs one key stroke to reshuffle the list of items (sorting the list in random order every time you press the key F9):

  • Insert 2 columns to the left of the list of items you want to shuffle
  • In the first column fill a series of numbers starting with 1
  • In the next column fill RAND() formula
  • Now, next to the list of items you want to sort in random order, we will use both VLOOKUP() and SMALL() excel formulas to fetch items in random order. See the formula below:

    sort a list of items in excel in random order using formulas

    The SMALL() excel spreadsheet formula is used to sort a list of numbers and fetch nth smallest number in a given list.

  • When you want to reshuffle the order, just hit F9

More sorting: Sort text / tables from left to right along columns


Hello Awesome...

My name is Chandoo. Thanks for dropping by. My mission is to make you awesome in Excel & your work. I live in Wellington, New Zealand. When I am not F9ing my formulas, I cycle, cook or play lego with my kids. Know more about me.

I hope you enjoyed this article. Visit Excel for Beginner or Advanced Excel pages to learn more or join my online video class to master Excel.

Thank you and see you around.

Related articles:

Written by Chandoo
Tags: , , , , , ,
Home: Chandoo.org Main Page
? Doubt: Ask an Excel Question

11 Responses to “Sorting a list of items in random order in excel – using formulas”

  1. JR says:

    Have you tried the =Sort() function in Google spreadsheets?
    I know, believe me, how much fun it is to use all sorts of cool combinations of functions to achieve these little tasks - but Sort() doesn't take away that fun - it just adds another tool to the box ... and then check out Unique() and Filter().... Can't wait to see what you do with those 😉

  2. Chandoo says:

    @JR ... Yeah, the SORT(), UNIQUE() and FILTER() are pretty powerful functions and I use them to speed up work whenever I can. I wish MS would add these as basic functions in the spreadsheet and use continue() mechanism to handle arrays instead of those complex array formulas.

  3. shilpa says:

    I Have the list of codes which are of 9 digits each and values of that codes, now I wish to make the sum of all those values against codes having "1" or "2" as its 3rd digit out of nine. please help me in this regard. will using if formula help?

  4. Chandoo says:

    @Shilpa... you can use sumif() formula to do this.

    First next to the codes insert a blank column and fill it with the formula to fetch the 3rd digit of the code. you can use mid(code,3,1) to do this.

    Then you can use sumif() on this column and values column to conditionally sum values when the code is 1 and 2.

    Read more on sumif() here: http://chandoo.org/wp/2008/06/09/what-the-if-learn-6-cool-things-you-can-do-with-excel-if-functions/

  5. [...] If you would like to randomize the suitcase - value assignments, just set “Play game?” to “No” and excel shuffles the values for you. (How to shuffle a list of values in excel using formulas?) [...]

  6. CharlesA says:

    Thanks! This is exactly what I needed. Love this site.

  7. Kuldeep says:


  8. Peter says:

    This is perfect, in conjunction with the Solver add-in for generating the shortest path (points), for generating random to/from tickets in the game “Ticket to Ride.”

  9. Sreedhar says:

    Dear Chandoo garu,

    i want to make
    1.an S-Curve in excel

    all these comes for Project management areas,kindly help how to automate in excel.

Leave a Reply

« »