To generate a random list with no duplicates in Excel, the fastest method is using the =SORTBY(range, RANDARRAY(ROWS(range))) formula in Microsoft 365, or by creating a helper column with =RAND() and sorting it in older versions. These methods ensure that every item from your original list is selected exactly once in a randomized order, effectively eliminating the risk of duplicate entries that occurs when using a standard RANDBETWEEN function.

What You'll Need

  • Microsoft Excel (The version determines which formula you can use).
  • A source list of data (names, ID numbers, or items) that you want to randomize.
  • An empty area in your worksheet to output the randomized results.

Step-by-Step

Depending on your version of Excel, you will use either a dynamic array formula or a manual sorting method. Dynamic arrays are available in Microsoft 365 and Excel 2021 or later.

Method 1: Using Dynamic Array Formulas (Excel 365/2021)

  1. Prepare your source data: Place the list of items you want to randomize in a single column. For example, put your list in cells A2 through A21.
  2. Select the output cell: Click on the cell where you want the randomized, non-duplicate list to begin (e.g., cell C2).
  3. Enter the SORTBY formula: Type the following formula: =SORTBY(A2:A21, RANDARRAY(ROWS(A2:A21))).
  4. Break down the formula:
    • A2:A21 is the range containing your original data.
    • ROWS(A2:A21) counts how many items are in your list (in this case, 20).
    • RANDARRAY(20) creates a list of 20 random decimals.
    • SORTBY takes your original list and reorders it based on those random decimals.
  5. Press Enter: Excel will automatically "spill" the results down the column. Because it is sorting an existing list rather than picking numbers at random, it is mathematically impossible to have a duplicate unless the original list already contained duplicates.

Method 2: The Helper Column Method (All Excel Versions)

  1. Set up your data: Ensure your list is in one column (e.g., Column A).
  2. Create the helper column: In the cell immediately to the right of your first item (B2), type =RAND().
  3. Fill the formula down: Click the bottom-right corner of cell B2 and drag it down to the end of your list. This assigns a unique random decimal between 0 and 1 to every row.
  4. Sort the data: Highlight both columns (A and B). Go to the Data tab on the ribbon and select Sort.
  5. Configure the sort: In the Sort dialog box, choose "Sort by Column B" and leave the order as "Smallest to Largest" or "Largest to Smallest."
  6. Finalize: Click OK. Your list in Column A is now randomized. You can now delete Column B.

Method 3: Randomly Selecting a Subset (No Duplicates)

If you have a list of 100 names but only need to pick 5 random winners without duplicates, use this approach in Excel 365:

  1. Use the INDEX and SORTBY combination: In your target cell, enter: =INDEX(SORTBY(A2:A101, RANDARRAY(ROWS(A2:A101))), SEQUENCE(5)).
  2. How it works: The SORTBY part randomizes the entire list of 100. The SEQUENCE(5) part tells the INDEX function to only return the first 5 items from that randomized list.

Common Mistakes

One of the most frequent errors is using =RANDBETWEEN(1, 20) repeatedly in a column. While this generates random numbers, it does so independently for every cell. This means the formula does not "remember" which numbers it has already picked, leading to inevitable duplicates. To avoid this, always use a sorting-based approach rather than a picking-based approach.

Another common mistake is forgetting that RAND() and RANDARRAY() are volatile functions. A volatile function recalculates every single time you make a change to any cell in the workbook, press F9, or save the file. If you have a randomized list that you need to keep permanent (such as a tournament bracket or a prize winner list), failing to lock the values will result in the list changing every time you type a word elsewhere in the sheet.

Users also frequently apply the SORTBY formula to a range that includes the header row. If your range is A1:A21 and A1 is "Employee Name," the header will be treated as a data point and will be shuffled into the random list. Always start your range at the first actual data entry (e.g., A2).

Tips

To stop your random list from changing constantly, you must convert the formulas into static values. Once you are happy with the random order, highlight the results, press Ctrl + C to copy, right-click the same area, and select Paste Values (the icon with "123"). This removes the formula and leaves only the text, freezing the list in place.

If you are working with a massive dataset (thousands of rows), the helper column method is often more stable than complex dynamic arrays, as it reduces the calculation load on the CPU during data entry. For smaller lists, the SORTBY method is significantly faster to implement.

To make your source list more flexible, convert it into an official Excel Table (select the data and press Ctrl + T). If you use a Table, you can reference the table name in your formula (e.g., =SORTBY(Table1[Names], RANDARRAY(ROWS(Table1[Names])))). The benefit here is that if you add new names to the bottom of the table, the random formula will automatically include them without you having to update the cell ranges manually.

Troubleshooting

The formula returns a #NAME? error: This almost always means you are using an older version of Excel that does not support RANDARRAY or SORTBY. These functions were introduced in Microsoft 365 and Excel 2021. If you see this error, you must switch to the Helper Column Method described in Method 2.

The formula returns a #SPILL! error: This occurs when there is existing data in the cells where Excel is trying to place the randomized list. For example, if your formula is in C2 and it needs to output 20 rows, but you have a stray piece of text in cell C10, the formula cannot "spill" the results. Clear all cells below and to the right of your formula cell to resolve this.

The list is not randomizing: If you are using the Helper Column method and the list doesn't seem to change, check if your Calculation Options are set to Manual. Go to the Formulas tab > Calculation Options and ensure Automatic is selected. If it is set to Manual, the RAND() function will not update until you manually trigger a recalculation.

Duplicates are still appearing: Check your source data. The sorting methods described here cannot create new duplicates; they only rearrange what is already there. If you see "John Doe" twice in your randomized list, it is because "John Doe" appeared twice in your original source list. Use the Remove Duplicates tool under the Data tab on your source list before randomizing.

Frequently Asked Questions

Can I randomize a list across multiple columns?

Yes. The SORTBY function can handle multi-column ranges. Instead of selecting one column (A2:A21), select the entire table (A2:C21). The formula will shuffle the rows while keeping the data within each row together.

Is there a way to do this without formulas?

Yes, the Helper Column method is essentially a non-formula approach once the initial =RAND() is entered and the data is sorted. Alternatively, some users use third-party add-ins, but the built-in sort method is the most secure and reliable.

Does the RANDARRAY function work in Excel Online?

Yes, RANDARRAY and SORTBY are fully supported in the web version of Excel, as Excel Online always runs the most current version of the software.

How do I ensure the random list stays the same for everyone who opens the file?

Because random functions recalculate, every user will see a different order unless you Paste Values. To ensure consistency, the creator of the sheet should randomize the list, copy the results, and Paste Values before sharing the workbook.

Can I randomize a list and exclude certain items?

Yes. You can use the FILTER function inside the SORTBY function. For example, =SORTBY(FILTER(A2:A21, A2:A21<>"Excluded"), RANDARRAY(ROWS(FILTER(A2:A21, A2:A21<>"Excluded")))) will remove any row containing the word "Excluded" before randomizing the remainder.