How to generate random numbers in excel without duplicates
Tutor 5 (99 Reviews)
Excel Tutor
Still stuck with a Excel question
Ask this expertAnswer
Generating random numbers without duplicates in Excel requires careful use of formulas and functions to ensure uniqueness.
Method 1: Using RAND and RANK
Enter the numbers 1 through the maximum number you want in a column (e.g., A1:A100).
In the adjacent column (B1), enter the formula:
=RAND()
This generates a random decimal number between 0 and 1 for each row.
In a third column (C1), enter the formula to rank the random numbers:
=RANK(B1, $B$1:$B$100)
This will assign unique ranks to each number, effectively shuffling the original numbers.
The column with the ranks now represents a list of unique random numbers. Copy and paste them as values to prevent recalculation.
Method 2: Using SEQUENCE and SORTBY (Excel 365 or newer)
Enter the formula:
=SORTBY(SEQUENCE(n,1,1,n),RANDARRAY(n))
Replace
nwith the number of unique random numbers you want.This formula generates a sequence from 1 to
nand sorts it randomly usingRANDARRAY.The result is a column of unique random numbers without duplicates.
Method 3: Using RANDBETWEEN with Helper Column
In a column, enter the formula:
=RANDBETWEEN(1,100)
Replace
1and100with your desired range.Check for duplicates using conditional formatting:
Select the column → Home → Conditional Formatting → Highlight Cells Rules → Duplicate Values.
Manually remove duplicates or use the
Remove Duplicatesfeature:Select the column → Data → Remove Duplicates.
Notes
Method 2 is the most efficient for dynamic lists in modern Excel.
Method 1 works in all Excel versions and gives precise control over the range.
Method 3 requires extra steps and is less automated, but can be useful for smaller ranges.
Related Questions
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