The RANDBETWEEN function
Returns a random whole number between a bottom and a top number, both included. It changes every time the sheet recalculates.
Syntax
RANDBETWEEN(bottom, top)- bottom
- The smallest number it can return.
- top
- The largest number it can return.
Examples
B1=AND(RANDBETWEEN(1,6)>=1,RANDBETWEEN(1,6)<=6)
| A | B | |
|---|---|---|
| 1 | TRUE |
B1=MOD(RANDBETWEEN(10,99),1)
| A | B | |
|---|---|---|
| 1 | 0 |
C1=ISTEXT(INDEX(A2:A5,RANDBETWEEN(1,4)))
| A | B | C | |
|---|---|---|---|
| 1 | Name | TRUE | |
| 2 | Ann | ||
| 3 | Ben | ||
| 4 | Cy | ||
| 5 | Dee |
Questions
Is the top number included in RANDBETWEEN?
Yes. =RANDBETWEEN(1,6) can return 1, 6 and every whole number between them, like a die.
How do I pick a random name from a list?
Use RANDBETWEEN for the position and INDEX to fetch it, as in =INDEX(A2:A5,RANDBETWEEN(1,4)). Change the 4 when the list grows, or use ROWS(A2:A5).