Summary
The Excel RANDBETWEEN function generates a random integer between two specified values, inclusive. It’s widely used in scenarios requiring random whole number generation, such as in simulations, statistical sampling, gaming applications, or any situation where a random integer is needed.
Syntax
=RANDBETWEEN(bottom, top)
- bottom: The smallest integer RANDBETWEEN will return
- top: The largest integer RANDBETWEEN will return
Return value
A random integer between the specified bottom and top values.
How to use
Use RANDBETWEEN by specifying the bottom (smallest) and top (largest) values of the range within which you want a random integer. The function will return a random integer within this range.
Examples
Simple RANDBETWEEN
Generating a Random Integer Within a Range: To get a random integer between two numbers:
=RANDBETWEEN(1, 10)
This formula generates a random integer between 1 and 10.
RANDBETWEEN in Simulations
Random Number for Simulations or Models: Using RANDBETWEEN to simulate a dice roll:
=RANDBETWEEN(1, 6)
This formula simulates rolling a dice, returning a number between 1 and 6.
RANDBETWEEN for Sampling
Random Selection in Sampling Projects: Selecting a random sample number from a specific range:
=RANDBETWEEN(100, 500)
Generates a 5×2 array of random decimal numbers between 0 and 50.
Additional Notes
- RANDBETWEEN is a volatile function, recalculating and generating a new number each time the worksheet recalculates.
- Perfect for scenarios where a random integer within a specific range is required.