Quick Navigation
RANDBETWEEN Function
Summary
The RANDBETWEEN function generates a random integer within a specified range, from a minimum bottom value to a maximum top value. Every time the worksheet recalculates, it produces a fresh random integer, making it perfect for simulations, testing, and random data generation.
Syntax
RANDBETWEEN(bottom, top)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| bottom | Integer |
Yes | Minimum integer boundary (inclusive) - the lowest possible result |
| top | Integer |
Yes | Maximum integer boundary (inclusive) - the highest possible result |
Using the RANDBETWEEN Function
RANDBETWEEN is ideal for creating random samples, test data, simulations, and randomized lists. Use it to generate random integers for lottery simulations, employee assignments, priority rankings, or any scenario requiring random whole numbers within defined limits.
Common RANDBETWEEN Examples
Basic Random Number Generator
=RANDBETWEEN(1,100)
Generates a random integer between 1 and 100. Perfect for lottery numbers or random selection.
Negative Range Example
=RANDBETWEEN(-10,10)
Creates random integers from -10 to 10, useful for simulating gains/losses or temperature variations.
Random Priority Assignment
=RANDBETWEEN(1,5)
Assigns random priorities (1=highest, 5=lowest) for task management.
Frequently Asked Questions
Common Errors and Solutions
#NUM! Error
Cause: Bottom value is greater than top value
Solution: Ensure bottom ≤ top and both are valid integers
Unexpected recalculation
Cause: New random numbers appear when editing sheet
Solution: This is normal behavior. Copy > Paste Special > Values to freeze results
Notes
- RANDBETWEEN recalculates whenever F9 is pressed or sheet changes
- To freeze random numbers, copy and Paste Special > Values
- Use with RAND() for decimal random numbers
- Maximum range is limited by Excel's integer limits (±2^15)
Compatibility
Available in: Excel 2007, Excel 2010, Excel 2013, Excel 2016, Excel 2019, Excel 2021, Microsoft 365
Not available in: Excel 2003 and earlier
Content last reviewed: December 9, 2025
Update frequency: As needed
Excel versions tested: Excel 2007+