# Random Numbers in Excel

To generate a random number in Excel, use the RAND() function, which returns a random number between 0 and 1. It will return a different random number each time the cell is recalculated (e.g. if you re-calculate by pressing F9) or the next time you open the workbook.

## Random Numbers in a Specified Range

To get a random integer (i.e. whole number) in a particular interval, use the RANDBETWEEN() function. This has two parameters which are the lowest and highest values you want to get a random number between. For example, =RANDBETWEEN(200,300) will return a random integer between 200 and 300. Again, you’ll get a new random number each time you refresh (you can Copy and Paste Values into the same cells if you want to keep the random numbers you’ve generated).

If you need a random number in an interval which isn’t rounded to the nearest whole number, you can use the output from the RAND() function and a bit of simple maths to get this. For example, =200 + RAND()*(300-200) will give you a random number between 200 and 300 which isn’t rounded.

## Example

The output from each of these functions is shown below: Updated: