Related Functions
Purpose
Get a random integer between two values
Return value
An integer
Syntax
=RANDBETWEEN (bottom, top)
Arguments
- bottom – An integer represening the lower value of the range.
- top – An integer represening the lower value of the range.
Usage notes
Use the RANDBETWEEN function to get a random integer between bottom and top. For example, =RANDBETWEEN(1,50) might generate the number 28
RANDBETWEEN calculates a new value each time the worksheet is calculated. To stop random numbers from being updated, copy the cells that contain RANDBETWEEN to the clipboard, then use Paste Special > Values to convert to text.
To generate a set of random integers in multiple cells, select the cells, enter the RANDBETWEEN function, and press control + enter.
To get a random number that doesn’t change when the worksheet is calculated, enter RANDBETWEEN in the formulas bar and then press F9 to convert the formula into its result.