What is the RAND function?
=RAND()RAND returns a random number greater than or equal to 0 and less than 1. It changes to a new value every time the sheet recalculates.
This page shows a different value each time you reload it.
RAND is used for drawing lots, making dummy test data and picking a random sample from a list. In practice the value itself matters less than putting RAND in a helper column and sorting or ranking by it.
Arguments
This function has no arguments. Write it with empty parentheses, like =NAME().
RAND examples
Example 1. A decimal between a and b
=RAND()*(b-a)+aFor example, =RAND()*90+10 is at least 10 and less than 100.
Example 2. A random integer
=INT(RAND()*45)+1An integer from 1 to 45, the same as RANDBETWEEN(1,45).
Example 3. Shuffle a list
=RAND()Fill a helper column with RAND and sort by it to shuffle the order.
Example 4. Random order
=RANK(B2, $B$2:$B$6)Put =RAND() in column B and rank it in column C to get the order 1 to 5 with no repeats. The values change on every recalculation, so paste them as values once decided.
Name Column B =RAND() (sample) Order Liam 0.62 2 Emma 0.15 5 Noah 0.88 1 Olivia 0.47 3 Ava 0.31 4 Example 5. Split by probability
=IF(RAND()<0.3, "Win", "Lose")About 30% of results are "Win". With few draws it will not be exactly 30%.
Common mistakes
The value keeps changing
To freeze it, copy and paste as values.
Expecting 1
RAND never returns 1.
Using ROUND for whole numbers
=ROUND(RAND()*10, 0) gives 0 and 10 only half as often as the other numbers. Use INT or RANDBETWEEN for equal chances.
Changes on every edit
Editing any other cell recalculates the sheet and changes the draw. Paste the results as values right away.
FAQ
- Only integers?
- Use RANDBETWEEN.
- Can I stop it from changing?
- Paste it as a value, or set calculation to manual.
- Whole numbers with no repeats?
- Make a column of RAND and take each value's RANK: you get 1 to n with no repeats.
- Several random numbers at once?
- In versions with RANDARRAY, =RANDARRAY(5) spills five random numbers.