Microsoft Office Tutorials and References

In Depth Information

**Syntax**

Figure 11.20.

Figure 11.20.
Harriet gets to draft first in this season
’
s fantasy football

Harriet gets to draft first in this season
’
s fantasy football

league, thanks to the

league, thanks to the RAND

RAND function.

function.

You can also use this technique to select a random subset from a data set. If

your manager wants you to contact every 20th customer, you can select all

the customers where =RAND() is 0.05 or less.

Syntax

=RANDBETWEEN(bottom,top)

Whereas =RAND() returns a random decimal, =RANDBETWEEN generates an in-

teger between two integers.

The RANDBETWEEN function returns a random integer between the numbers

you specify. A new random number is returned every time the worksheet is

calculated. This function takes the following arguments:

•
bottom

bottom
—
This is the smallest integer RANDBETWEEN can return.

•
top

top
—
This is the largest integer RANDBETWEEN can return.

To generate random numbers between 50 and 59, inclusive, you use

=RANDBETWEEN(50,59). RANDBETWEEN is easier to use than =RAND to

achieve

random

integers;

with

=RAND,

you

would

have

to

use

=INT(RAND()*10)+50 to generate this same range of data.

Even though RANDBETWEEN generates integers, you can use it to generate

sales prices or even letters. =RANDBETWEEN(5000,9900)/100 generates ran-

dom prices between $50.00 and $99.00.