How to generate random numbers between range in excel without duplicates
Tutor 5 (118 Reviews)
Excel Tutor
Still stuck with a Excel question
Ask this expertAnswer
Generating random numbers in Excel is common for simulations, sampling, or testing. Ensuring no duplicates requires a precise approach since Excel’s standard random functions may repeat values.
Can Excel generate random numbers without duplicates?
Yes. Excel can generate random numbers without duplicates by combining its random number functions with formulas or tools that remove duplicates automatically.
Method 1: Using the RAND and RANK Functions
List the numbers in your desired range in a column.
Example: For numbers between 1 and 50, enter 1, 2, 3, …, 50 in column A.In column B, generate a random decimal for each number:
=RAND()
Fill down for all rows in the range.
In column C, rank the random numbers to create a unique order:
=RANK(B1, $B$1:$B$50)
Column C now provides a list of numbers in random order with no duplicates.
This method ensures that each number appears once, while still being random.
Method 2: Using the UNIQUE and RANDARRAY Functions (Excel 365 / 2021)
Use the RANDARRAY function to generate multiple random numbers:
=SORTBY(SEQUENCE(50,1,1,1),RANDARRAY(50))
Explanation:
SEQUENCE(50,1,1,1)generates numbers 1 to 50 in order.RANDARRAY(50)generates 50 random decimals.SORTBYsorts the sequence according to random decimals, producing a random order without duplicates.
Adjust the first argument in
SEQUENCEto match the size of your range.
This method is dynamic and updates automatically when the sheet recalculates.
Method 3: Using Data Validation for Selection Without Duplicates
If you want users to pick random numbers without duplicates in a column:
Prepare a list of numbers in a separate range.
Select the column where numbers will appear.
Go to Data → Data Validation → Allow: List.
Reference the prepared list.
Users can pick numbers from the dropdown without duplicating values.
Tips and Best Practices
Always fix your number range with absolute references (
$A$1:$A$50) to prevent formula errors when copying.Use RANDARRAY in Excel 365 or 2021 for simpler, faster results.
To prevent recalculation from changing your random numbers, copy the final list and use Paste Values.
For large ranges (hundreds or thousands), the RAND/RANK method ensures uniqueness efficiently.
This approach allows generating random numbers between any range in Excel without duplicates while maintaining flexibility for future adjustments or expansions.
. Was this Helpful?Get Online Tutoring or Questions answered by Experts.
You can post a question for a tutor or set up a tutoring session
Answers · 1
How to freeze a row in excel
Answers · 1
How to freeze the top three rows in excel
Answers · 1
How to freeze the top two rows in excel
Answers · 1
How to freeze top row excel mac
Answers · 1