Return a random number between 0 and 1
=RAND()
RAND is useful for generating random numbers that recalculate every time a sheet is opened or changed or F9 is pressed.
RAND uses the Mersenne Twister algorithm (MT19937) to generate random numbers.
RAND and numbers.
In the examples below, the RAND function is used to generate volatile and non-volatile random numbers, in single cells and arrays.
Use the RAND function to generate random numbers.

Syntax
=RAND()
The RAND function has no arguments.
Try it now!
- Enter your formulas into the grey cells.
Scope
RAND has no arguments to define.
|
=RAND() || result is a random number greater than or equal to 0 and less than 1. |
|
=RAND()*100 || result is a random number greater than or equal to 0 and less than 100. |
|
=RAND()*(20-10)+10 || result is a random number greater than or equal to 10 and less than 20. |
|
=INT(RAND()*100) || result is a random integer greater than or equal to 0 and less than 100. |
|
=RAND() then press F9 || result is a random number greater than or equal to 0 and less than 1 that does not change when the workbook is opened or changed. |
Caveats
- RAND is a volatile function that will change every time a workbook is opened or changed or the F9 key is pressed.
- To create a single non-volatile random number, enter the RAND() function into the formula bar then press F9 to convert the formula into its result. Alternatively, copy and paste special values the result into the desired cell.
- To create an array of random numbers, select the desired range, then enter =RAND() followed by CTRL + ENTER. This generates the formula {=RAND()}.
- To create a random number between 2 values, use =RAND()*(value2-value1)+value1 (e.g. =RAND()*(20-10)+10).
- The RANDBETWEEN and RANDARRAY (Excel 365) functions can also be used to generate random values between 2 values.
Related Functions
- RANDARRAY: (Excel 365) return an array of random decimal or integer numbers between specified values.
- RANDBETWEEN: to generate random integers between 2 values.
Functions Category