Generate a list of unique random numbers in Excel without duplicates using built-in functions like RANDARRAY, SORTBY, and SEQUENCE, or with helper columns and formulas for older versions.

What You'll Need

  • Microsoft Excel (2021 or later for dynamic array functions; Excel 2019 or earlier with workaround)
  • A blank worksheet
  • Basic knowledge of Excel formulas

Step-by-Step

  1. Open Excel and select a blank worksheet.
  2. Decide how many unique random numbers you need and the range (e.g., 10 numbers between 1 and 100).
  3. For Excel 2021 or Microsoft 365:
    1. In cell A1, enter the formula: =SORTBY(SEQUENCE(n), RANDARRAY(n)), replacing 'n' with the count of numbers needed (e.g., 10).
    2. Press Enter. This generates 'n' unique random integers from 1 to 'n'.
    3. To change the range (e.g., 1 to 100), use: =INDEX(SORTBY(SEQUENCE(100,1,1), RANDARRAY(100)), SEQUENCE(10)) for 10 unique numbers between 1 and 100.
    4. The result spills into adjacent cells automatically.
  4. For Excel 2019 or earlier:
    1. In column A, enter your desired range (e.g., 1 to 100 in A1:A100).
    2. In column B, next to each number in A, enter: =RAND() in B1 and drag down to B100.
    3. Select both columns A and B.
    4. Go to the Data tab and click Sort.
    5. Sort by Column B, Smallest to Largest.
    6. After sorting, column A now contains a randomized order of your original numbers.
    7. Copy the top 'n' numbers from column A (e.g., A1:A10) to get your unique random sample.
    8. To prevent recalculation, copy and paste as values (Ctrl+C, then right-click > Paste Special > Values).
  5. Optional: To regenerate a new set, press F9 (for RAND-based methods) or re-enter the formula (for dynamic arrays).
  6. Ensure no duplicates by verifying the count of unique values using: =COUNTUNIQUE(range) (Excel 365) or =SUMPRODUCT(1/COUNTIF(range,range)) (older versions).

Common Mistakes

  • Using =RAND() alone without sorting or helper columns, which only gives random decimals, not unique integers.
  • Forgetting to lock ranges when copying formulas, leading to incorrect references.
  • Assuming RANDARRAY produces unique values by default — it does not; sorting is required.
  • Not pasting as values after sorting, causing the list to change on every edit.
  • Using RANDBETWEEN in a loop or fill-down, which often produces duplicates.

Tips

  • Use the SEQUENCE function to generate your number range dynamically instead of typing it out.
  • For reproducible results, replace RANDARRAY with a seeded random method using VBA if needed (though this requires macros).
  • Label your columns clearly (e.g., 'Original', 'Random Sort') to avoid confusion.
  • Test with a small sample first (e.g., 5 numbers from 1-10) to verify uniqueness before scaling up.
  • If you need non-integer unique randoms, adjust the SEQUENCE step size (e.g., SEQUENCE(100,1,0.1,0.1) for tenths).

Troubleshooting

  • If you see a #SPILL! error: Check that the cells where the result should spill are completely empty. Delete any content in the spill range.
  • If formulas return duplicates: Confirm you are using SORTBY with RANDARRAY — RANDARRAY alone does not guarantee uniqueness.
  • If the RAND() method doesn’t randomize: Ensure you sorted by the helper column (B), not the original data.
  • If Excel seems slow with large ranges (e.g., 10,000+ numbers): Limit the range to only what you need, or use VBA for better performance.
  • If you’re using an older Excel version and don’t see dynamic arrays: Confirm your version supports them (2021 or 365). Otherwise, use the helper column method.

Frequently Asked Questions

Can I generate unique random numbers without duplicates in Excel?

Yes, using SORTBY and SEQUENCE in modern Excel, or a helper column with RAND and sorting in older versions.

Will the random numbers change every time I edit the sheet?

Yes, because RAND and RANDARRAY are volatile. Copy and paste as values to fix the result.

Can I generate unique random numbers between two specific values, like 50 and 150?

Yes. Use: =INDEX(SORTBY(SEQUENCE(101,1,50), RANDARRAY(101)), SEQUENCE(10)) for 10 unique numbers from 50 to 150.

Is there a way to do this without formulas?

Not reliably. Manual methods are error-prone. Formulas or VBA are the only practical approaches.

Does this work in Excel for Mac?

Yes, the same functions and steps apply in Excel for Mac 2021 or later. Older Mac versions require the helper column method.

Can I use this for random sampling without replacement?

Exactly. This method produces a simple random sample without replacement from a defined population.