The Excel Randbetween function generates a random integer between two supplied integers.
The syntax of the function is:
where the bottom and top arguments are integers representing the lower and upper limits for the generated random number.
The following spreadsheet shows two examples of the Excel Randbetween function used to generate random integers.
|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.
For further information on the Excel Randbetween Function, see the Microsoft Office website.
If you get an error from the Excel Randbetween function, this is likely to be one of the following:
|#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.|