What is the RANDBETWEEN function?
=RANDBETWEEN(bottom, top)RANDBETWEEN returns a random integer between bottom and top, both included.
If bottom is larger than top, it returns #NUM!. The value changes on every recalculation.
RANDBETWEEN makes dummy test data (scores, quantities, dates) and picks one item at random from a list. Both ends are included, so =RANDBETWEEN(1, 6) returns 1 and 6 as often as any other number.
Arguments
- bottom
- The smallest integer that can be returned.
- top
- The largest integer that can be returned.
RANDBETWEEN examples
Example 1. A lottery number
=RANDBETWEEN(1, 45)One of 1 to 45.
Example 2. A die
=RANDBETWEEN(1, 6)1 to 6.
Example 3. A random date
=RANDBETWEEN(DATE(2026,1,1), DATE(2026,12,31))Format the cell as a date for a random day in 2026.
Example 4. Dummy data
=RANDBETWEEN(50, 100)Choose a range for each column and copy down. Results change on every recalculation.
Column Formula Sample Score =RANDBETWEEN(50, 100) 73 Qty =RANDBETWEEN(1, 40) 18 Amount =RANDBETWEEN(10, 100)*100 4,700 Example 5. Steps of 0.1
=RANDBETWEEN(0, 100)/10Returns 0.0 to 10.0 in steps of 0.1.
Common mistakes
Duplicates
Used in several cells, the same number can come up more than once.
The value keeps changing
Paste as values to freeze it.
Arguments in the wrong order
=RANDBETWEEN(100, 1), with the larger number first, returns #NUM!.
FAQ
- Random decimals?
- Use RAND.
- Random pick from a list?
- Use =INDEX(list, RANDBETWEEN(1, ROWS(list))).
- Numbers with no repeats?
- RANDBETWEEN can repeat. Make a RAND column and use RANK on it.