Syntax
| Parameter | Description |
|---|---|
| bottom | Parameter of the RANDBETWEEN function. |
| top | Parameter of the RANDBETWEEN function. |
Examples
Dice roll
=RANDBETWEEN(1, 6)
Random employee ID
=RANDBETWEEN(1000, 9999)
Random date in 2025
=RANDBETWEEN(DATE(2025,1,1), DATE(2025,12,31))
Common Errors
Bottom must be less than or equal to top. =RANDBETWEEN(10, 5) returns #NUM! because the range is inverted.
Non-numeric arguments return #VALUE!.
Tips
Both the bottom and top values can be returned. RANDBETWEEN(1,6) can return 1, 2, 3, 4, 5, or 6.
Fill a column with =RANDBETWEEN(18, 65) for random ages, or =RANDBETWEEN(30000, 120000) for random salaries in test datasets.
Since dates are numbers internally, RANDBETWEEN works great for random dates. Wrap in DATE for bounds and format the output cell as a date.
Try RANDBETWEEN in Viztab
Import your data and use RANDBETWEEN with 370+ other formulas. No signup required.
Open Viztab