Selecting Ten Random Numbers

Written by Allen Wyatt (last updated October 18, 2025)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Excel in Microsoft 365


1

Fawn needs a way to select 10 whole numbers from a pool of 150 potential numbers. For instance, if the pool contains the sequential whole numbers of 201 through 350, she needs to select 10 numbers from that pool, at random.

The traditional way to do this is to use a very simple function in a cell, like this:

=RANDBETWEEN(201,350)

This returns a single random value between 201 and 350, inclusive. Copy the formula down for 9 more cells, and you end up with the 10 desired random values. The problem, though, is that you could end up with duplicate values. This is especially true if the pool of potential numbers is reduced in size and the number of desired values increases.

Continuing down the traditional path, this potential of duplication is reduced significantly by using the RAND function instead of RANDBETWEEN. This is because RAND returns a value greater than or equal to 0 and less than 1, at a precious of 15 decimal places. Thus, you could use the following formula in a cell to return a number in the range of 201 to 350:

=INT(RAND()*150)+201

Copy this down to 9 more cells, and you end up with your 10 desired values, with virtually zero chance of duplication.

With the advent of the newest dynamic array functions, the approach can be simplified quite a bit. Consider the following formula:

=RANDARRAY(10,1,201,350,1)

This returns 10 integer values between 201 and 250. The problem here is the same as it is with RANDBETWEEN—there could easily be duplicates. Some suggest that you can remove the problem by enclosing the function within the UNIQUE function:

=UNIQUE(RANDARRAY(10,1,201,350,1))

This does ensure that no duplicates are returned, but you are no longer guaranteed to always have 10 values, which goes against what Fawn needs.

The best solution is to not force RANDARRAY to use integer values. If you allow it to work with decimal values, it acts very much like the RAND function, returning an array of values between 0 and 1. To see how powerful this can be, consider the following formula:

=TAKE(SORTBY(SEQUENCE(150,1,201),RANDARRAY(150)),10)

The SEQUENCE function returns an array of values 201 through 350 and the RANDARRAY function returns an array of 150 random values between 0 and 1. The SORTBY function is then used to sort the integer sequence by the results of the random array. Finally, the TAKE function returns the first 10 values from the sorted array. The result is always 10 values, always in random order, with absolutely no chance of duplicates.

The SEQUENCE, SORTBY, RANDARRAY, and UNIQUE functions are available in Excel 2021 and 2024. To use the TAKE function you will need Excel 2024. All of these functions are available to users of Microsoft 365.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2319) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Excel in Microsoft 365.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Messed-up Typing

It is not uncommon for newcomers to Word to overwrite their existing document text as they are editing. There is a reason ...

Discover More

Unhiding or Listing All Objects

An Excel workbook can contain quite a few different objects. Sometimes those objects can be hidden so that they are not ...

Discover More

Displaying Fields

Fields (sometimes called field codes) allow you to insert dynamic information in your documents. If you want to see the ...

Discover More

Dive Deep into Macros! Make Excel do things you thought were impossible, discover techniques you won't find anywhere else, and create powerful automated reports. Bill Jelen and Tracy Syrstad help you instantly visualize information to make it actionable. You’ll find step-by-step instructions, real-world case studies, and 50 workbooks packed with examples and solutions. Check out Microsoft Excel 2019 VBA and Macros today!

More ExcelTips (ribbon)

Removing Duplicates at a Reduced Precision Level

The precision of numeric values you display in a worksheet can be less than what is actually maintained by Excel. This ...

Discover More

Quickly Adding Formulas Referencing Multiple Worksheets

When you need to pull information from a lot of different worksheets into a single worksheet, it can be baffling to ...

Discover More

Getting a Conditional Count of Cells Containing Values

Excel provides several worksheet functions that can be used to count cells containing values--"particularly numeric ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is five minus 1?

2025-10-18 10:44:59

Mike J

Allen's comment about the second formula is a bit mystifying. Using the RAND() function may well give 15 digits of precision, but by the time the result has been multiplied by 150 and then truncated by the INT() function to just 3 significant digits, you have just as much chance of returning duplicates as the previous formula.

If truly random numbers need to be generated, Excel is probably not the generator of choice.
Online random number generators are probably better, e.g. random.org/integers has a simple interface that serves this purpose extremely well and has an API that could be used (by someone more experienced than I) to produce the desired output automatically.

But even truly random numbers may well still produce duplicates.


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.