probability

A

alusia stuart

I am looking for the function that randomly delivers a number from an
array of numbers. For example, inputing a number set of 0 through
100, this function will deliver a random number.

Thank you.
 
B

Bernard Rey

alusia stuart wrote :
I am looking for the function that randomly delivers a number from an
array of numbers. For example, inputing a number set of 0 through
100, this function will deliver a random number.

Have a look at the "RAND()" and the "RANDBETWEEN(min,max)" worksheet
functions. I suppose the second one matches exactly your needs, but you have
to install the analysis toolpak add-in to have work.

So if you think of sending your worksheet to people qho might not have it
installed, you'll have to use the more standard "RAND()" where "=RAND()*100"
is more or less equivalent to "=RANDBETWEEN(0,100)" and "=10+RAND()*100" to
"=RANDBETWEEN(10,110)"
 
J

J.E. McGimpsey

Bernard Rey said:
So if you think of sending your worksheet to people qho might not have it
installed, you'll have to use the more standard "RAND()" where "=RAND()*100"
is more or less equivalent to "=RANDBETWEEN(0,100)" and "=10+RAND()*100" to
"=RANDBETWEEN(10,110)"

Small point:

Since RANDBETWEEN() includes both ends of the interval (0 and 100)
in the possible results, the equivalent of

=RANDBETWEEN(0, 100)

would be

=INT(RAND()*101)

and the equivalent of

=RANDBETWEEN(10, 110)

would be

=INT(RAND()*101) + 10

Note that the RAND() function stinks at generating pseudorandom
numbers. It's good enough for the lottery or an office pool, but
don't expect to use it for serious statistical work.
 
D

David J. Braden

If you want an integer from a contiguous range of numbers such as
0,1,2,3,...,100, I suggest RANDBETWEEN. For a***l-retentive folks like
me, it isn't the best thing on the planet, but might suffice for your
application.

If you want to get a single sample from an arbitrary data set, that
might even include text or booleans, then, to make this easy on
yourself, Insert/Name/Define the set as something like "SampleRng" (do
this by selecting, say, B2:B101, before naming the thing). I'm assuming
your data are in a column.

Then in a convenient cell, such as C2, enter the formula
=INDEX(SampleRng,RANDBETWEEN(1,ROWS(SampleRng))).

Check out Excel's Help on Index to see what it does; it's a very useful
function.

Note that you have to have the Ananlysis ToolPak installed
(Tools/Add-Ins) for this to work. If you are uncomfortable with that,
then repost, and we can show you how to generate integers from the core
Excel product; it's easy, and actually better implemented, but not as
self-documenting as what I'm suggesting.

Hope this helps,
Dave Braden
MVP - Excel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top