Create a Unique Random Sample Without Duplicates in Excel
Question details
Create a random sample of 29 records from a population of 116 records without selecting any record more than once.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- The user needs to randomly choose a fixed number of unique rows from a source list.
- Observed behavior
- The desired result is a shuffled selection containing 29 different records, with no duplicates.
Confirm that the source list contains only the records you want to sample and that the requested sample size does not exceed the number of available rows. The dynamic-array formula below requires a version of Excel that supports SORTBY, RANDARRAY, and SEQUENCE.
Shuffle the full range and return the first 29 unique records
Use this method in modern Excel to generate a random sample without replacement from a single-column list.
RANDARRAY assigns a new random value to every source record, SORTBY uses those values to shuffle the list, and INDEX returns the first 29 rows of the shuffled result. Because each source row is shuffled only once, the returned records are unique.
Click an empty cell where the 29 sampled records can spill into adjacent cells, such as C2.
Type =INDEX(SORTBY(A2:A117,RANDARRAY(ROWS(A2:A117))),SEQUENCE(29)) and press Enter. Replace A2:A117 with the full range containing your 116 records.
Excel returns 29 randomly ordered records below the formula cell. Each result comes from a different row in the source range.
To stop the sample from changing, select the returned results, press Ctrl+C, then use Home > Paste > Paste Values to save the current records as fixed values.

Use a helper column to shuffle records in older Excel versions
Use this alternative when your Excel version does not provide RANDARRAY, SORTBY, or SEQUENCE.
Create a duplicate-free random sample in WPS Spreadsheets
WPS Spreadsheets can shuffle a source list with dynamic-array functions and return a fixed number of unique records. Enter the sampling formula in an empty area, then paste the results as values when you want to keep the selected sample.
- 1. Open the worksheet in WPS Spreadsheets: Open your .xlsx workbook in WPS Office and locate the column that contains the full population list.
- 2. Choose an empty output cell: Click a blank cell with enough space below it for the requested sample, such as C2.
- 3. Enter the sampling formula: Enter =INDEX(SORTBY(A2:A117,RANDARRAY(ROWS(A2:A117))),SEQUENCE(29)) and press Enter, updating the range and sample size as needed.
- 4. Fix the selected records: Select the spilled results, choose Home > Paste > Paste Special > Values, and save the workbook to retain that random sample.

Frequently Asked Questions
Why does the random sample change every time I edit the worksheet?
The RANDARRAY function recalculates with the workbook. To retain a specific selection, copy the returned sample and use Home > Paste > Paste Values.
How do I sample entire rows instead of values from one column?
Change the source range in the formula to include all required columns, for example A2:D117. SORTBY will shuffle the rows together, and INDEX with SEQUENCE(29) returns the first 29 shuffled rows.
Can I request more than 29 records with this formula?
Yes. Replace SEQUENCE(29) with the number of records you need, but do not use a number larger than the number of records in the source range.
Does sorting by RANDARRAY create duplicate records?
No. The method shuffles the existing source rows and returns a subset of them. It does not randomly draw the same source row repeatedly, so each selected row appears only once.




