Excel Randbetween Function

Related Function:
RAND function

Function Description

The Excel Randbetween function generates a random integer between two supplied integers.

The syntax of the function is:

RANDBETWEEN( bottom, top )

where the bottom and top arguments are integers representing the lower and upper limits for the generated random number.


Randbetween Function Examples

The following spreadsheet shows two examples of the Excel Randbetween function used to generate random integers.

  A
1 =RANDBETWEEN( 1, 10 )  - returns a random integer between 1 and 10
2 =RANDBETWEEN( -2, 2 )  - returns a random integer between -2 and 2

Note that the above formulas will return a different random integer every time the spreadsheet recalculates. To force a recalculation at any time, press the F9 key.


See the Microsoft Office website for further details on the Excel Randbetween Function.


Randbetween Function Errors

If you get an error from the Excel Randbetween function, this is likely to be one of the following:

Common Errors
#NUM! - Occurs if the supplied bottom argument is greater than the supplied top argument.
#VALUE! - Occurs if either of the supplied arguments are non-numeric.