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.
Written by Allen Wyatt (last updated November 18, 2023)
This tip applies to Excel 97, 2000, 2002, and 2003
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:
Figure 1. The Data Analysis dialog box.
Figure 2. The Random Number Generation dialog box.
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.
Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!
Excel provides several different functions that you can use to generate random numbers. One of the most useful is the ...
Discover MoreEver need to populate some cells in your worksheet with a range of data, but in random order? Here's a handy macro to get ...
Discover MoreIt is not unusual to need to select two random items from a list. There are a couple of ways you can approach the task; ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)
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.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2024 Sharon Parq Associates, Inc.
Comments