RAND function
The RAND function in Excel generates a random decimal number between 0 (inclusive) and 1 (exclusive). Each time the worksheet recalculates, the function produces a new random value.
Syntax
=RAND()
Key Features
- No arguments: The
RANDfunction does not take any parameters. - Volatile function: It recalculates every time the workbook is recalculated, such as when you enter new data, press
F9, or modify a cell. - Output range: The output is always between 0 and less than 1.
Examples
- Generate a random number between 0 and 1:
=RAND()Example result:
0.8467 - Generate a random number in a specific range: To generate a random number between
aandb, use:=RAND() * (b - a) + aExample: For a random number between 10 and 20:
=RAND() * (20 - 10) + 10 - Generate a random integer in a specific range: Combine
RANDwithINTorROUND:=INT(RAND() * (b - a + 1)) + aExample: For a random integer between 1 and 100:
=INT(RAND() * 100) + 1
Tips
- If you don’t want
RANDto change every time the worksheet recalculates, copy the cell containingRANDand paste it as a value usingCtrl + Alt + V→ “Values.” - For generating random numbers without decimals directly, consider using the
RANDBETWEENfunction.