To randomly select in Excel, add a helper column with =RAND() next to your data, copy it down, then sort the whole range by that column (smallest to largest or largest to smallest) and take the top rows — or use =RANDARRAY() and =INDEX() to pull a random sample without sorting. For a fixed number of winners, =TAKE(SORTBY(range,RANDARRAY(ROWS(range))),n) returns n random items in one formula. That is the whole method; the rest of this guide covers the exact clicks, the differences between versions, and the traps that make people think Excel is broken.
What You'll Need
- Excel for Microsoft 365, Excel 2021 or later for the dynamic-array formulas (RANDARRAY, SORTBY, TAKE). Older versions still work with the RAND() helper-column method.
- Your data laid out with one item per row and no blank rows inside the range.
- A backup copy of the sheet if you plan to sort the original data, since sorting rearranges rows permanently.
Step-by-Step
Method 1: Helper column plus sort (works in every Excel version)
- Click the first empty cell immediately to the right of your data, in the same row as the first item. If your data ends in column C, start in D2.
- Type =RAND() and press Enter. The cell shows a decimal between 0 and 1.
- Hover over the bottom-right corner of that cell until the cursor becomes a thin black cross, then double-click or drag down to fill the formula to the last row of your data. Every row now has its own random number.
- Select the entire block — data plus the helper column — or click any cell inside it and press Ctrl+A (Cmd+A on Mac).
- Go to Data > Sort. In the Sort by dropdown, choose your helper column. Leave Order as Smallest to Largest. Click OK.
- The rows shuffle. The first n rows are now a random selection. Copy them elsewhere before you do anything else.
- Delete the helper column, or leave it — but note it recalculates every time the sheet changes, so the order will not stay stable.
Method 2: A single formula that returns a random sample (Microsoft 365 and Excel 2021+)
- Pick an empty cell with at least n rows of space below it and to the right.
- Type =TAKE(SORTBY(A2:A100,RANDARRAY(ROWS(A2:A100))),5) to return 5 random items from A2:A100. Change the 5 to however many you need.
- Press Enter. The results spill into the cells below. If you see a #SPILL! error, something is blocking the output range — clear those cells and it will fill.
- To freeze the result, select the spilled cells, copy, then paste with Paste Special > Values. Otherwise the sample changes whenever the sheet recalculates.
Method 3: Pick one random name from a list
- In an empty cell, type =INDEX(A2:A100,RANDBETWEEN(1,COUNTA(A2:A100))).
- Press Enter. The cell shows one random entry from the list. Press F9 to reroll.
- For a no-duplicates draw of several names, use the SORTBY/TAKE formula from Method 2 instead — RANDBETWEEN can repeat the same row.
Method 4: Random sampling with the Analysis ToolPak (Windows desktop)
- Go to File > Options > Add-ins, select Excel Add-ins at the bottom, click Go, tick Analysis ToolPak and click OK.
- On the Data tab, click Data Analysis, choose Sampling and click OK.
- Set the Input Range to your data, choose Random under Sampling Method, enter the sample size, and pick an Output Range. Click OK.
Menu names can differ slightly by Excel version, platform and region — on Mac the Data Analysis tool lives under the Data tab too, but only if the add-in is enabled.
Common Mistakes
- Sorting only the helper column. If you select just column D and sort, the random numbers detach from their rows and your data is scrambled. Always select the whole block, or use the Sort dialog with the header row handled properly.
- Forgetting that RAND() recalculates. Every edit, every recalculation and every reopen rerolls the numbers. Copy and paste as values the moment you have your selection.
- Using RAND() to assign fixed IDs. It is not a stable identifier. Use a real key column for that.
- Leaving blank rows in the range. ROWS() and COUNTA() then count wrong, and your sample can include empty cells.
- Expecting RANDARRAY in Excel 2019 or earlier. It does not exist there; the formula returns #NAME?. Use Method 1 instead.
Tips
- Use =RAND() for sorting and =RANDBETWEEN(1,1000) when you want whole numbers you can eyeball.
- To sample a percentage rather than a count, multiply: =ROUND(COUNTA(A2:A100)*0.1,0) gives 10% of the list.
- Add a second helper column with a fixed ID before sorting, so you can restore the original order afterwards with a sort on that ID.
- For repeatable draws, paste the random values as values into a separate column and sort on those — the same sample can then be reproduced.
- If you need a random order rather than a subset, SORTBY with RANDARRAY reshuffles the whole list in one step.
Troubleshooting
- #NAME? error. Your Excel version does not support the function. Switch to the RAND() helper-column method.
- #SPILL! error. The output range is not empty. Clear the cells below and to the right of the formula.
- #VALUE! error. ROWS() or COUNTA() is pointing at a range containing errors, or the range reference is malformed. Check the colons and sheet name.
- The selection keeps changing. That is normal recalculation. Copy the results and paste as values to lock them.
- Sort does nothing. You probably have a filter applied, or the range was not fully selected. Clear filters with Data > Clear, then reselect the whole block.
- Duplicates appear. RANDBETWEEN and repeated RAND() draws can repeat. For unique winners, sort by RAND() and take the top n rows instead.
Frequently Asked Questions
Does RAND() ever return the same number twice?
Yes, occasionally. It returns a decimal between 0 and 1, and with large datasets collisions are possible. For a unique draw, sort by the random column and take the top rows.
Can I randomly select without sorting my data?
Yes. Use the TAKE/SORTBY/RANDARRAY formula, or INDEX with RANDBETWEEN for a single pick. Neither rearranges your original rows.
Why does my random selection change every time I edit the sheet?
RAND, RANDBETWEEN and RANDARRAY are volatile functions — they recalculate on any change. Paste the results as values to freeze them.
Is there a way to pick random rows in Excel Online?
Excel for the web supports RAND and, in current versions, the dynamic-array functions. The Analysis ToolPak is not available there, so use the helper-column or formula methods.
How do I pick a random name from a list with blanks in it?
Blanks skew COUNTA and ROWS. Either clean the list first or use FILTER to remove blanks before applying the random formula.
Can I weight the random selection?
Yes, but it needs a helper column: multiply RAND() by a weight, then sort descending and take the top rows. Higher weights tend to sort higher.