View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Joe User[_2_] Joe User[_2_] is offline
external usenet poster
 
Posts: 905
Default Randbetween function

"mike_vr" wrote:
Does anyone know how I can have six cells next to each other,
using the =RANDBETWEEN(1,49) function, where none of the
cells equal each other?


Alternative....

Put =RAND() into A1:A49, copy-and-paste-special-value into B1:B49, then put
the following into C1 and copy into C2:C6:

=rank(B1,$B$1:$B$49)

To generate a new set, copy-and-paste-special-value A1:A49 into B1:B49
again.

The copy-and-paste-special-value is needed to work around the fact that RAND
is a volatile function, so it changes every time any cell in the Excel file
is edited.


----- original message -----

"mike_vr" wrote in message
...
Hi there

Does anyone know how I can have six cells next to each other, using the
=RANDBETWEEN(1,49) function, where none of the cells equal each other?
I.e. a random lottery function without having two of the same numbers.
I'm trying to do this without creating a huge nested If statement so any
help would be appreciated.

Cheers
Mike