## How to generate random number without duplicates in Excel?

Author: Sun Last Modified: 2020-04-22

In many cases, you may want to generate random numbers in Excel? But with the general formulas to randomize numbers, there may be some duplicate values. Here I will tell you some tricks to generate random numbers without duplicates in Excel.

Generate unique random numbers with formulas

#### Generate unique random numbers with formulas

To generate the unique random numbers in Excel, you need to use two formulas.

1． Suppose you need to generate random numbers without duplicates into column A and column B, now select cell E1, and type this formula =RAND(), then press Enter key, see screenshot:

2. And select the whole column E by pressing Ctrl + Space keys simultaneously, and then press Ctrl + D keys to apply the formula =RAND() to the whole column E. See screenshot:

3. Then in the cell D1, type the maximum number of your needed random number. In here case, I want to insert random numbers without repeated between 1 and 50, so I will type 50 into D1.

4. Now go to Column A, select cell A1, type this formula =IF(ROW()-ROW(A\$1)+1>\$D\$1/2,"",RANK(OFFSET(\$E\$1,ROW()-ROW(A\$1)+(COLUMN()-COLUMN(\$A1))*(\$D\$1/2),),\$E\$1:INDEX(\$E\$1:\$E\$1000,\$D\$1))), then drag the fill handle to next column B, and drag down the fill handle to the range you need. See screenshot:

Now, in this range, the random numbers you need are no repeated.

Note:

1. In the above long formula, A1 indicates the cell you use the long formula, D1 indicates the maximum number of the random number, E1 is the first cell of column you apply formula =RAND(), and 2 indicates you want to insert random number into two columns. You can change them as your need.

2. When all the unique numbers are generated into the range, the redundant cells will be shown as blank.

3. With this method, you just can generate random number start from number 1. But with the second way, you can easily specify the random number range.

#### Generate unique random number with Kutools for Excel’s Insert Random Data

With above formulas, there are too much inconvenience to handle. But with Kutools for Excel’s Insert Random Data feature, you can quickly and easily to insert the unique random numbers as your need which will saves a lot of time.

### Less Time but Higher Productivity

Includes 300+ professional tools for Excel 2019-2003
First version 1.0 was released in 2011, now is the version 18.0
Solves most Excel daily complex tasks in seconds, save your time
30-day free trial without any limitation

After installing Kutools for Excel, please do as below:

1. Select the range you need to generate random numbers, and click Kutools > Insert > Insert Random Data. See screenshot:

2. In the Insert Random Data dialog, go to the Integer tab, type the number range you need into the From and To text boxes, and remember to check Unique values option. See screenshot:

3. Click Ok to generate the random numbers and exit the dialog.

Note:If your selected cells are more than the random numbers, the redundant cells are displayed as blank.

You also can insert the random unique date, random unique time by Insert Random Data. If you want to have a free trial of Insert Random Data, please downloan it right now!

Tip.If you want to select or sort data randomly, please try to use the Kutools for Excel’s Sort Range Randomly as shown in the following screenshot. It’s full function without limitation in 30 days, please download and have a free trial now.

#### Quickly Insert multiple checkboxes or buttons into a range of cells in worksheet

In Excel, you only can insert one checkbox/button into a cell once time, it will be troublesome if there are multiple cells needed to be inserted checkboxes/buttons at the same time. Kutools for Excel has a powerful utility -- Batch Insert Check Boxes / Batch Insert Option Buttons can insert checkboxes/buttons into the selected cells with one click .  Click for full-featured  free trial in 30-day!

### Best Office Productivity Tools

 🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions… Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ... Super Lookup: Multiple Criteria VLookup  |   Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup .... Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List .... Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ... Featured Features: Grid Focus   |  Design View   |   Big Formula Bar   |  Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells   |  Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ... Top 15 Toolsets:  12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...

#### Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

• Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
• Open and create multiple documents in new tabs of the same window, rather than in new windows.
• Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
Comments (17)
This comment was minimized by the moderator on the site
En la parte Genere números aleatorios únicos con fórmulas como hago para ampliar el numero de columnas pasar de 2 a 5 sin repetir los numeros segun la formula que ud puso: =IF(ROW()-ROW(A\$1)+1>\$D\$1/2,"",RANK(OFFSET(\$E\$1,ROW()-ROW(A\$1)+(COLUMN()-COLUMN(\$A1))*(\$D\$1/2),),\$E\$1:INDEX(\$E\$1:\$E\$1000,\$D\$1)))
This comment was minimized by the moderator on the site
Hello. I just found this site, and am trying to figure out best way to assign a new code to people. I'd like to assign a random code for people to use between 1000 and 65000, that does not equal any codes already assigned. I'd also like it to be formatted with 5 numbers (00000), but that's not a big deal if it doesn't take care of that. Any ideas on how to make this work? TIA :-)
This comment was minimized by the moderator on the site
Hi, Janel, why you donot try the Data Validation in Excel? It can only allow whole numbers between 1000 and 65000 to be entered in a cell range.
This comment was minimized by the moderator on the site
Help anyone :-) This one I cannot figure out. At our school we often put together students in groups - 2 and 2 together for a number of working sessions. 9 in this case. There are 18 students (vary) in the class. What I am chasing is a formula that gives me a random result of who should work together in the 9 working sessions without having students meeting each other twice. So I need Excel to give me a result of 18 students spread across 9 working sessions and any student must not be match with another student twice. How the xxxx do I fix that? I have search all over the place for inspiration without luck. Any input is appreciated :-)
This comment was minimized by the moderator on the site
Hi, Anders, you need to list all names in column A, then in column B, apply formula =rand(), then specify 2 as the size in cell F2, now apply this formula =ROUNDUP(RANK(B3,\$B\$3:\$B\$19)/\$F\$2,0) in column C as below screenshot shown
This comment was minimized by the moderator on the site
Hi. Thanks for your reply.
I understand you suggestions, but how do I achieve a setup where all students are assigned to maksimum number of workshops where 2 students are randomly assigned to first one workshop, then the second workshop, then the third workshop etc. etc. and to take this even further a student must not be matched with another student that he/she already have worked with. So when having 18 students I need "the system" to allocate all student to (in this case) 9 workshop (e.g. one workshop per week) and no student should be a student they have already worked with.
This comment was minimized by the moderator on the site
Hi there, did you ever manage to work out a solution to this, I've encountered the same issue. Any help would be appreciated.
This comment was minimized by the moderator on the site
Or you could use a sudoku setup.
There are no comments posted here yet
Load More
Leave your comments
Posting as Guest
Suggested Locations