RANDBETWEEN gives a random whole number in a range — for test data, dice rolls, or random sampling. RAND gives a random decimal between 0 and 1, the engine behind random picks and shuffles.
The example
Random values for sample data (yours will differ — they reroll each calc).
| A | B | |
|---|---|---|
| 1 | Formula | Example result |
| 2 | RANDBETWEEN(1,100) | 47 |
| 3 | RANDBETWEEN(1,6) (die) | 4 |
| 4 | RAND() | 0.812 |
The formula
A random number in a range:
How it works
Two random generators for different needs:
RANDBETWEEN(low, high)returns a random whole number in that inclusive range — great for IDs, dice, or test data.RAND()returns a random decimal from 0 up to 1 — use it for probabilities or as a sort key.- Both are volatile: they recalculate (reroll) on every edit and when you press F9.
- Random pick from a list:
=INDEX(list, RANDBETWEEN(1, ROWS(list)))grabs a random item.
To freeze a random value so it stops changing, copy the cell and Paste Special → Values. Otherwise every recalculation gives a new number — which is great for generating data, but not if you need it to stay put.
Try it: interactive demo
Set a range and reroll.
Variations
Random pick from a list
Grab a random item:
Random decimal in a range
Between min and max:
Random array (365)
A whole grid at once:
Pitfalls & errors
They never stop changing. RAND/RANDBETWEEN reroll on every recalc. Paste Special → Values to lock a result in place.
RANDBETWEEN can repeat. It samples with replacement, so duplicates happen. For unique picks, see “random without repeats.”
Volatile = slower. Thousands of volatile random cells can bog down a big workbook.
Practice workbook
Frequently asked questions
How do I generate a random number in Excel?
How do I pick a random item from a list?
How do I stop a random number from changing?
Stop fighting formulas. Learn them in a day.
This recipe is one of hundreds of real-world formulas we teach. Our Excel Formulas & Functions class covers lookups, logic, text, and dynamic arrays hands-on — live in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.
See the Formulas & Functions Class