Microsoft Excel provides the facility to generate random numbers. There are two functions that can do this for you:

- RAND
- RANDBETWEEN

## The RAND Function

The RAND function returns a random number between 0 and 1 and requires no arguments. It is possible to create a number in a different range than 0 – 1, but that requires some extra bits adding to the formula. For example, to just get a random number between 0 and 1, you would type into a cell the following:

=RAND()

To get a random number between 150 and 200, you would use:

=RAND()*50 + 150

That is,

=RAND()*(b-a)+a

The random number is returned every time the worksheet is calculated. If you want the random number to be constant, and not change every time the worksheet is calculated, enter the RAND() formula in the formula bar, and then press F9 to change the formula to a random number.

## The RANDBETWEEN Function

The RANDBETWEEN Function returns a random integer number between the numbers you specify. A new random integer number is returned every time the worksheet is calculated.

For example, to get a random integer between 20 and 50, you would type into a cell the following:

=RANDBETWEEN(20, 50x)

## Generating Lots Of Random Numbers

To quickly generate random numbers in many cells, all you have to do is generate the first random number in a particular cell, say with =RAND(). Next, make that cell active and position the cursor over the bottom right corner of the cell until the cursor changes to a ‘**+**‘. When you see the ‘**+**‘, drag downwards. When you release the mouse, the selected cells will be populated with random numbers.

You can take this one step further: while that column of cells is selected, again, drag the bottom right corner of the bottom cell over to the right. When you release the mouse, all selected cells will be populated with random numbers.