Function Problems

Generate Unique Random Numbers That Stay Fixed in Excel

John WilsonJohn Wilson Nov 18, 2026 870 views

Question details

Generate unique random numbers in Excel and keep previously generated values unchanged when more numbers are needed.

Generate Unique Random Numbers That Stay Fixed in Excel
Product
Microsoft Excel
Device & OS
not provided
Scenario
The user needs to request random numbers in batches without repeating or changing earlier results.
Observed behavior
The desired result is a fixed list of unique random numbers from which additional unused values can be selected.
Before you start

Choose the number range and the maximum quantity you will need. The Excel formula below uses Microsoft 365 dynamic array functions and needs 100 empty cells below the starting cell.

Solution 1Recommended

Shuffle and freeze a complete pool of numbers in Excel

Use this method to draw unique numbers in batches while keeping the original results fixed.

Generate and freeze the entire pool before taking the first batch. Freezing only the displayed batch would not prevent a newly generated batch from repeating earlier numbers.

1
Generate the pool

In cell A1, enter =SORTBY(SEQUENCE(100),RANDARRAY(100)). Excel spills the numbers 1 through 100 in a random order into A1:A100.

2
Freeze the results

Select A1:A100 and copy it. With the same range selected, choose Home > Paste > Paste Special > Values to replace the formulas with fixed numbers.

3
Take the first batch

Copy the first 10 numbers from A1:A10, or enter =TAKE(A1:A100,10) in an empty cell to display them.

4
Take more unused numbers

When you need 10 more numbers, use the next unused cells, A11:A20. Continue down the frozen list and track where each batch ends.

Shuffle and freeze a complete pool of numbers in Excel
Pool size matters: Change both instances of 100 in the formula to the size of the pool you need before generating it. You cannot draw more unique numbers than the pool contains.
WPS Office

Create a fixed random number pool in WPS Spreadsheets

Use a helper column and sorting in WPS Spreadsheets to shuffle a list of unique numbers, then draw unused values from the fixed list.

  1. 1. Create a numbered list: In WPS Spreadsheets, enter 1 in A2 and =A2+1 in A3. Drag the fill handle from A3 down to A101 to create the numbers 1 through 100.
  2. 2. Add random sort keys: Enter =RAND() in B2 and drag its fill handle down to B101.
  3. 3. Freeze the keys: Copy B2:B101, then use Paste Special > Values on the same range so the random keys no longer recalculate.
  4. 4. Shuffle the numbers: Select A2:B101 and use Data > Sort to sort the selected range by column B. Keep both columns selected so each number moves with its key.
  5. 5. Draw numbers in batches: Copy the first numbers you need from column A. For later batches, continue from the next unused row without reshuffling the list.
Draw unique random numbers in batches from one shuffled poolOpen and save Microsoft Excel XLSX filesUse familiar spreadsheet formulas and sorting toolsWork with a free, easy-to-use office suite
microsoft office alternative - wps office

Frequently Asked Questions

Why do my random numbers change in Excel?

RANDARRAY recalculates when Excel recalculates the workbook. Select the entire generated range, copy it, and use Home > Paste > Paste Special > Values to make the results fixed.

Can I generate another batch without repeating earlier numbers?

Yes. Freeze a complete shuffled pool first, then take each new batch from the next unused rows. Generating a separate random pool can repeat numbers from earlier batches.

How do I change the range from 1–100 to another range?

For a consecutive range starting at 50 and containing 100 numbers, use =SORTBY(SEQUENCE(100,1,50),RANDARRAY(100)). Freeze the full spill range as values before taking any batches.

What if Excel does not recognize SORTBY or TAKE?

These functions require a supported Excel version. You can instead create a numbered list, add a RAND() helper column, paste the helper values, and sort both columns together by the helper column.