Professional Documents
Culture Documents
Generating Random Numbers in Excel
Generating Random Numbers in Excel
Introduction
Excel is a versatile and powerful spreadsheet tool for many analytics tasks. One of these is statistical
analysis of data and it is a market leader in this field. Excel is able to run various statistical functions and
one such example is the ability to generate random numbers in Excel workbooks.
This function has to be activated by enabling add ins which we would discuss in this article. But first let
us look at a few examples of the function. The feature provides seven distribution types to generate
numbers based on specified parameters. For starters, we open an excel file and click on any cell, then
we have to input =RAND().
This is the most basic from of the RAND function and requires no argument to be written in the
parentheses.
Examples
We will take a look at more advanced examples in the following few paragraphs.
a) To generate a list of random numbers: We can use the RAND function to generate a list of
random numbers. It can be done by filling the first cell with =RAND() and dragging the fill handle
till the cell we want as shown.
We can copy and paste the values to a different column to make the RAND function go away
and use the values as is the case with any excel formula.
b) To generate a list of random numbers between specified values: We can use the RAND function
to generate a list of numbers between two specified values by using two different modifications
of this function as shown below:
1) For a random whole number between two integers we use the function RANDBETWEEN:
c) To generate a random set of values from a given list: We can use the RAND function to generate
a set of values from a given list of strings, in this case, we would pick out random names from a
list.
To simplify this, we can change the reference style to default in excel menu. The INDEX function
is combined with RANDBETWEEN for such cases.
What are RAND and RANDBETWEEN and where can they be useful?
The RAND function can be used to generate a random real number in uniform distribution less than 1
and greater than or equal to 0 unless we specify the range. The RANDBETWEEN function always returns
a random integer between two specified values.
Both these functions return random numbers with a single distribution. The numbers may or may not be
in the upper or lower limit of the requested range. The uses of these functions range from analytics in
marketing to quality control and forecasting.
Now that we have seen a few examples of the function RAND and RANDBETWEEN for random number
generation, we will look at how to activate the features and enable these functions in excel.
We start by opening up excel and clicking on File menu. This takes us to a screen as shown below:
After clicking on Options, we select Add Ins menu in the pop up window that appears:
We select Analysis ToolPak :
In this screen we can select the only Analysis ToolPak, or select all and click on Ok.
Once we have activated the functionality, we can use it in two ways. One way as shown in the examples
would be to use functions and formulae. The other more user friendly graphical way is to use the Data
tab as described below:
e) The Output Range should also be specified so that excel knows where to place the result.
Click Ok and we will see a result like this:
Conclusion
Since the usefulness of random number generation depends a lot on our familiarity with statistics and
distribution, the following is a short description of each distributions’ qualities:
Patterned: Numbers have a lower and upper limit, a step, repetition rate for values and a repetition rate
for the sequence.
Discrete: Has a value and probability associated with it, so uses two columns to display the results, the
sum of probabilities should be 1.
As discussed above, we see that random number generation is not just a set of random numbers, but
like any data, has a pattern to it. It is these patterns that make it such a powerful analytics tool.