View Single Post
  #13   Report Post  
Posted to microsoft.public.excel.newusers
[email protected] curiousgeorge408@hotmail.com is offline
external usenet poster
 
Posts: 85
Default Random number Generator

On Jan 14, 9:09 pm, I wrote:
On Jan 14, 3:53 pm, "RagDyer" wrote:
In an out-of-the-way location, say Column Z, enter the Rand function[.]
In Z1 enter =Rand()[.] And copy down to Z49.
Then enter this formula wherever you wish:
=INDEX(ROW($A$1:$A$49),RANK(Z1,$Z$1:$Z$49))
Copy down as many rows as you need random numbers.

[....]
I agree that it works. But it seems that =RANK(Z1,$Z$1:$Z$49) would
suffice. RANK(Z1,$Z$1:$Z$49) seems to return the same thing that the
full INDEX expression returns. It seems that ROW($A$1:$A$49) is
always 1.


Only out of context. ROW($A$1:$A$49) returns the array {1,2,...,49}.
In the context of INDEX(), the RANK() result (1,2,...,49) is used to
index into that array.

In this context, I believe that using INDEX() and ROW() is redundant,
since the OP is interested in randomly choosing amount 1,2,...,49,
which is exactly what RANK() returns, given that Z1:Z49 contains
random values.

However, if the OP had been interested in, for example, randomly
selecting from the range 13-61, then perhaps INDEX(ROW($A$13:$A
$61),RANK(Z1,$Z$1:$Z$49)) could be used -- although, I believe that
12+RANK(Z1,$Z$1:$Z$49) would suffice.

On the other hand, if the OP had wanted to randomly select unique
values from A1:A49, then I believe INDEX($A$1:$A$49,RANK(Z1,$Z$1:$Z
$49)) could be used, copying down for as many selections as required.

RagDyer (or any other expert), please comment.