Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: AutoFill with Random Numbers.

AutoFill with Random Numbers

by Allen Wyatt
(last updated September 6, 2014)

2

Excel includes a feature that allows you to automatically fill a range of cells with information you have placed in just a few cells. For instance, you could enter the value 1 in a cell, and then 2 in the cell just beneath it. If you then select the two cells and drag the small black handle at the bottom right corner of the selection, you can fill any number of cells with incrementing numbers. This AutoFill feature sure beats having to type in all the values!

You may wonder if there is a similar way to use the AutoFill feature to place random numbers in a range. Unfortunately, the AutoFill feature was never meant for random numbers. Why? Because AutoFill uses predictive calculations to determine what to enter into a range of cells. For example, if you entered 1 into one cell and 5 into the next, highlighted the cells and then used AutoFill, the next number entered in the cell below would be 9 because Excel can deduce that the increment is 4. It is a constant increment that can be predicted.

Random numbers on the other hand are, well, random. By nature they cannot be predicted, else they wouldn't be random. Therefore the predictive nature of AutoFill cannot be applied to random numbers.

However, there are ways around this. One is to simply use the various formulas (using RAND and RANDBETWEEN) that have already been adequately covered in other issues of ExcelTips. These formulas can quickly and easily be copied over a range of cells, using a variety of copying techniques.

Another approach is to use a feature of the Analysis ToolPak which makes putting random numbers into a range of cells pretty easy. Just follow these steps:

  1. Choose Data Analysis from the Tools menu. (If you don't see the Data Analysis option on the Tools menu, it means that you don't have the Analysis ToolPak enabled.) Excel displays the Data Analysis dialog box. (See Figure 1.)
  2. Figure 1. The Data Analysis dialog box.

  3. In the list of functions in the dialog box, choose Random Number Generation.
  4. Click on OK. Excel displays the Random Number Generation dialog box. (See Figure 2.)
  5. Figure 2. The Random Number Generation dialog box.

  6. Using the controls in the dialog box, indicate the parameters you want used in generating a range of random numbers. (Make sure that you specify a range of cells in the Output Options area of the dialog box.)
  7. Click on OK.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2964) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: AutoFill with Random Numbers.

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

Confirming File Conversions

Open a file that isn't a Word document and Word will still try to convert it to a Word document. If you want Word to let you ...

Discover More

Incrementing Numeric Portions of Serial Numbers

If you use serial numbers that include both letters and numbers, you might wonder how you can increment the numeric portion ...

Discover More

Erratic Behavior of Ctrl+PgDn

Have you ever noticed that when you use Ctrl+PgDn or Ctrl+PgUp that Word may give you results you didn't expect. Here's why ...

Discover More

Excel Smarts for Beginners! Featuring the friendly and trusted For Dummies style, this popular guide shows beginners how to get up and running with Excel while also helping more experienced users get comfortable with the newest features. Check out Excel 2013 For Dummies today!

MORE EXCELTIPS (MENU)

Picking Different Random Numbers from a Range

It is not unusual to need to select two random items from a list. There are a couple of ways you can approach the task; the ...

Discover More

Playing with a Full Deck

Ever need to populate some cells in your worksheet with a range of data, but in random order? Here's a handy macro to get the ...

Discover More

Generating Double-Digit Random Numbers

Normally you use the RAND and RANDBETWEEN functions to generate random numbers. What if you want to generate random numbers ...

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 for this tip:

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}] in your comment text. You’ll be prompted to upload your image when you submit the comment. 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 two more than 9?

2014-11-24 14:37:07

Jim

Nice note ... unfortunately it suffers from the same problem as the associated Microsoft Help file: not a word on how to actually use this tool. I filled in blanks, added columns but to no avail. No matter what I did it complained that something was not right, as Madeleine would say. LOL


2014-09-08 10:27:31

Dave Bonin

I dislike the Excel RAND function as it is very difficult to debug.

Instead, I prefer to copy in a table of values (range of cells) from an existing set of non-changing random numbers.

One good, free set of values that you can easily find called "100,000 Random Normal Deviates" (I love the name) published by the Rand Corp in the 1950's. It's stood the test of time.

With a minimal effort, you'll easily find tables for uniform and other distributions.


This Site

Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon 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.

Links and Sharing