ExcelReady
CourseMock testsFunction guidesBlog
Start freeStart learning for free
ExcelReady

Be Excel-ready before day one. Hands-on practice in your browser, with instant feedback.

Learn

  • Course
  • Mock tests
  • Function guides
  • Blog

Test prep

  • Excel level test
  • Excel test practice
  • Free screening quiz
  • Certificate

Company

  • About
  • Editorial policy
  • Contact
  • Terms
  • Privacy

© 2026 ExcelReady. All rights reserved.

  1. Blog
  2. Dynamic arrays
  3. How to Randomize a List in Excel With SORTBY

How to Randomize a List in Excel With SORTBY

By ExcelReady Team·Updated November 2, 2026·5 min read

The short answer

To randomize a list in Excel 2021 or Microsoft 365, use =SORTBY(A2:A11,RANDARRAY(ROWS(A2:A11))). RANDARRAY makes one random number per row and SORTBY sorts the list by them, so the names spill out in a new random order. The order changes on every recalculation, so paste the result as values to keep it.

Key takeaways

  • =SORTBY(list,RANDARRAY(ROWS(list))) shuffles a list or a whole table in Excel 2021 and Microsoft 365.
  • RAND and RANDARRAY are volatile: the shuffle changes every time the sheet recalculates.
  • Copy the result and paste it as values to freeze the order.
  • Wrap the shuffle in TAKE or INDEX with SEQUENCE to pick a few random items with no repeats.
  • In older Excel, add a helper column with =RAND() and sort the list by it.
On this page+
  1. How to randomize a list with SORTBY and RANDARRAY
  2. Why the order keeps changing, and how to freeze it
  3. How to shuffle a whole table
  4. How to pick random names without repeats
  5. How to randomize a list in older Excel with RAND
  6. How to split a shuffled list into random teams
  7. Common problems when randomizing a list
  8. SORT or SORTBY for a random order?
  9. Practise it

To randomize a list in Excel, sort it by random numbers. In Excel 2021 or Microsoft 365, one formula does it: =SORTBY(A2:A11,RANDARRAY(ROWS(A2:A11))). In older versions, a helper column of RAND values and the Sort button do the same job. This guide covers both, plus how to freeze the order and pick random winners or teams without repeats.

How to randomize a list with SORTBY and RANDARRAY#

With names in A2:A11, click an empty cell such as C2 and type:

Excel formula
=SORTBY(A2:A11,RANDARRAY(ROWS(A2:A11)))

Press Enter and the ten names spill into C2:C11 in a random order. Spilling means one formula fills several cells by itself. Work through it from the inside out:

  1. ROWS(A2:A11) counts the rows in the list: 10.
  2. RANDARRAY(10) makes 10 random decimals between 0 and 1, one per row.
  3. SORTBY(A2:A11, …) sorts the names by those random numbers, smallest first.

Because the numbers are random, so is the order. Every name appears exactly once, with no repeats and none missing. SORTBY and RANDARRAY need Excel 2021, Excel 2024 or Microsoft 365. In older versions the formula shows #NAME?; use the helper-column method further down. For how SORTBY works in general, see the guide to SORT and SORTBY.

Why the order keeps changing, and how to freeze it#

RAND and RANDARRAY are volatile functions: they make new random numbers every time Excel recalculates. Typing in any cell, opening the file or pressing F9 (Mac: ⌘=) gives a new shuffle. That's handy for a fresh draw, but not for a list you need to keep. To freeze it:

  1. Select the shuffled cells, for example C2:C11, and copy them (Ctrl+C; Mac: ⌘C).
  2. Open Paste Special (Windows: Ctrl+Alt+V; Mac: Control+⌘+V).
  3. Choose Values and click OK.

The formula is replaced by plain names, so the order stays put. If you paste over the formula's own cells, the spill result becomes values in place.

How to shuffle a whole table#

SORTBY sorts every column you give it, so you can shuffle whole rows and keep each row together. With names, departments and emails in A2:C11:

Excel formula
=SORTBY(A2:C11,RANDARRAY(ROWS(A2:C11)))

The result spills three columns wide, and each person's department and email stay with their name. This is the safe way to shuffle: if you sort one column on its own, the rows get mixed up.

How to pick random names without repeats#

To choose a few random items, shuffle the list and take the top ones. Since each name appears once in the shuffle, no one can be picked twice. In Microsoft 365, TAKE keeps the first rows:

Excel formula
=TAKE(SORTBY(A2:A11,RANDARRAY(ROWS(A2:A11))),3)

This returns three random names. In Excel 2021, which has no TAKE, use INDEX with SEQUENCE:

Excel formula
=INDEX(SORTBY(A2:A11,RANDARRAY(ROWS(A2:A11))),SEQUENCE(3))

SEQUENCE(3) makes the list 1, 2, 3, so INDEX returns the first three rows of the shuffle. The SEQUENCE function guide explains it. For a single random pick, =INDEX(A2:A11,RANDBETWEEN(1,ROWS(A2:A11))) works in every version.

How to randomize a list in older Excel with RAND#

Before dynamic arrays, the method was a helper column and a normal sort. It still works in every version:

  1. In B2, type =RAND() and fill it down to B11 (Windows: Ctrl+D; Mac: ⌘D). Each row gets a random decimal.
  2. Click any cell in the list.
  3. Go to Data > Sort, choose to sort by column B, smallest to largest, and click OK.

The names in column A are now in a random order. RAND recalculates during the sort, so the helper numbers won't look sorted afterwards, but the shuffle has already happened. Sort again for a new order, and delete column B when you're done. This is the same method the exercise on this page uses, with the random numbers already frozen.

How to split a shuffled list into random teams#

Once the list is in random order, you can deal people into teams like cards. With the shuffled names in C2:C11, type this in D2:

Excel formula
=MOD(SEQUENCE(ROWS(C2:C11))-1,3)+1

It spills the team numbers 1, 2, 3, 1, 2, 3, 1, 2, 3, 1 down column D. MOD returns the remainder after dividing by 3, so the numbers repeat in a cycle. Because the names are already shuffled, each person lands in a random team, and the teams differ in size by one at most: here 4, 3 and 3. Change the 3 to the number of teams you need. Freeze the names first, or the teams will change on the next recalculation.

Common problems when randomizing a list#

Most issues come from spilling and from blank cells:

  • #SPILL! error. Something is in the way of the result. Clear the cells below and to the right of the formula. The guide to dynamic arrays in Excel explains spill ranges.
  • Blank rows in the shuffle. If the range includes empty cells, they get shuffled in as zeros or blanks. Remove them first with FILTER: =SORTBY(FILTER(A2:A20,A2:A20<>""),RANDARRAY(COUNTA(A2:A20))).
  • #VALUE! from SORTBY. The list and the random numbers must have the same number of rows. Using ROWS on the same range, as above, keeps them in step.
  • The list changes when you didn't want it to. Paste as values, as shown above.

SORT or SORTBY for a random order?#

SORTBY is the right choice, because it sorts by an array that isn't part of the list. SORT can only sort by a column inside the range, so you'd first have to add the random numbers as a column. The article on SORT vs SORTBY compares them in detail, and the SORT function guide covers SORT's arguments. When you need a fixed order that isn't A to Z, such as High, Medium, Low, see how to sort by a custom order with a formula.

Practise it#

Shuffling is one line once SORTBY feels natural. Practise SORTBY, XMATCH and spill references in a live spreadsheet, then practise the SORT function to sort tables by any column, ascending or descending. Every formula is checked the moment you press Enter. The exercise on this page is a good warm-up: sort six names by frozen random numbers.

Try it yourself

This is a live spreadsheet. Type the formula in the green cell and press Enter.

The random numbers in B2:B7 were made with RAND and already pasted as values, so they won't change. In D2, shuffle the names by sorting them by those numbers: =SORTBY(A2:A7,B2:B7), then press Enter.

fx
ABCDE
1
Name
Random
Shuffled
2
Aisha
0.62
3
Ben
0.15
4
Carmen
0.88
5
Dev
0.41
6
Elena
0.07
7
Felix
0.53
8
9
10

Tip: SORTBY takes the list to sort first, then the column to sort it by. Smallest numbers come first, so Elena should be at the top.

Practise this in a lesson

LessonModern Excel: XMATCH, SORTBY, TEXTSPLIT and spill references (A2#)Split names with TEXTSPLIT, find positions with XMATCH, sort by another column with SORTBY, and refer to a whole spilled result with A2#.LessonSORT: order data with a formulaSort a table by any column, ascending or descending, and combine SORT with FILTER and UNIQUE.Function guideSORTSort a range with a formula using Excel's SORT. Sort by any column, highest first, or combined with FILTER. Includes a live exercise.

Frequently asked questions

How do I randomly shuffle a list in Excel?

+

In Excel 2021 or Microsoft 365, type =SORTBY(A2:A11,RANDARRAY(ROWS(A2:A11))) in an empty cell. The list spills out in random order. In older versions, add =RAND() next to each item and sort by that column.

How do I stop a random list from changing?

+

Copy the shuffled cells and paste them as values with Paste Special > Values. The formulas are replaced by plain text, so the order no longer changes.

How do I pick random names from a list without duplicates?

+

Shuffle the list, then take the first few items: =TAKE(SORTBY(A2:A11,RANDARRAY(ROWS(A2:A11))),3) in Microsoft 365. Because each name appears once in the shuffled list, there are no repeats.

Is there a RANDOMIZE function in Excel?

+

No. Excel shuffles lists by sorting them by random numbers, using RAND or RANDARRAY together with SORTBY, or with a helper column and the Sort command.

Why does my random order change every time I edit the sheet?

+

RAND and RANDARRAY are volatile functions, which means they make new numbers each time Excel recalculates. Paste the result as values to keep one order.

Sources

  • SORTBY function - Microsoft Support
  • Dynamic array formulas and spilled array behavior - Microsoft Support
  • Sort data in a range or table - Microsoft Support

Written and checked by the ExcelReady Team. First published November 2, 2026. The practice exercise runs in the same formula engine as our lessons. Found a mistake? Read our editorial policy or email hello@excelready.app.

On this page

  1. How to randomize a list with SORTBY and RANDARRAY
  2. Why the order keeps changing, and how to freeze it
  3. How to shuffle a whole table
  4. How to pick random names without repeats
  5. How to randomize a list in older Excel with RAND
  6. How to split a shuffled list into random teams
  7. Common problems when randomizing a list
  8. SORT or SORTBY for a random order?
  9. Practise it

Keep reading

Dynamic arrays· 6 min read

SORT and SORTBY in Excel

SORT returns a sorted copy of a range: =SORT(A2:C9,3,-1) sorts by the 3rd column, largest first. SORTBY sorts one range by the values in another, so the column you sort by doesn't have to be in the result, and it handles several sort levels. Both leave the original data unchanged and need Excel 2021, Excel 2024 or Microsoft 365.

Comparisons· 8 min read

SORT vs SORTBY in Excel: Which Dynamic Sort

SORT orders a range by one of its own columns, chosen by position number: =SORT(A2:C6,2,-1) sorts by the second column, largest first. SORTBY orders a range by any range you point to, even one you don't return: =SORTBY(A2:A6,B2:B6,-1). Use SORT for quick single sorts and SORTBY for multi-level sorts or sorting by hidden or calculated values.

Dynamic arrays· 6 min read

Dynamic Arrays in Excel Explained Simply

Dynamic arrays let one Excel formula return several values that spill into the cells below or beside it. Type =UNIQUE(B2:B9) in one cell and the whole list appears, then resizes when the data changes. They need Excel 2021, Excel 2024, Microsoft 365 or Excel for the web. Refer to a whole spill with a # after its first cell, such as E2#.

More on dynamic arrays

  • How to Reverse the Order of a List in Excel
  • The SEQUENCE Function in Excel
  • Make a List of Dates With SEQUENCE in Excel
  • Sort and Filter Together With One Formula
  • Sort by Multiple Columns in Excel (Formula and Menu)
  • Sort by a Custom Order With a Formula
All dynamic arrays articles →

Don't just read about Excel. Do it.

Practise real formulas in a live spreadsheet with instant feedback, right in your browser. Nothing to download.

Start learning for free