Name
RANDBETWEEN
Synopsis
You can use RANDBETWEEN (an Analysis ToolPak function) to determine a random integer within the range you specify. When you use this function a new random integer is generated each time you open or recalculate the worksheet. Unlike RAND, this function only returns an integer value.
To Calculate
=RANDBETWEEN(Bottom
,Top
)
The Bottom
and
Top
arguments are required for this
function.
-
Bottom
Indicates the smallest number that you want returned by the function. If you specify a fractional value, the function will not return an integer value smaller than that value. For example, if you specify a value of 0.65 for the
Bottom
argument the smallest value that would be returned by the function is 1.-
Top
Indicates the largest number that you want returned by the function. If you specify a fractional value the function will not return an integer value larger than the specified value. For example, if you specified a value of 9.5 for the
Top
argument the largest value that would be returned would be 9.
Example
Figure 14-19 illustrates the differences between using RAND and RANDBETWEEN. Both functions produce random numbers that are regenerated whenever you recalculate the worksheet. RANDBETWEEN always returns an integer value.
Note
To find a random number between and 1, use RAND. RAND also allows you to determine random numbers that contain decimal values.
Get Excel 2000 in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.