J
Jerm
I am trying to return a Random number between 1:32 in 20 different cells
without repeating. Anyone?
without repeating. Anyone?
Shane Devenshire said:If you like RANDBETWEEN here is another approach
Enter RANDBETWEEN in as many cells as you want, say A1:A64 then in B1
enter
=SUMPRODUCT(COUNTIF(A1:A64,A1:A64))=COUNT(A1:A64)
Now either press F9 until B1 = FALSE or run the following macro:
Sub myRand()
Do Until [B1]= TRUE
Activesheet.Calculate
Loop
End Sub
Of course, since RANDBETWEEN is volatile you need to copy and paste the
set
somewhere else as values.
--
If this helps, please click the Yes button.
Cheers,
Shane Devenshire
Jerm said:I am trying to return a Random number between 1:32 in 20 different cells
without repeating. Anyone?
T. Valko said:I'm curious to know if you tested that and, if so, how long did it take to
get 64 unique random numbers?
--
Biff
Microsoft Excel MVP
Shane Devenshire said:If you like RANDBETWEEN here is another approach
Enter RANDBETWEEN in as many cells as you want, say A1:A64 then in B1
enter
=SUMPRODUCT(COUNTIF(A1:A64,A1:A64))=COUNT(A1:A64)
Now either press F9 until B1 = FALSE or run the following macro:
Sub myRand()
Do Until [B1]= TRUE
Activesheet.Calculate
Loop
End Sub
Of course, since RANDBETWEEN is volatile you need to copy and paste the
set
somewhere else as values.
--
If this helps, please click the Yes button.
Cheers,
Shane Devenshire
Jerm said:I am trying to return a Random number between 1:32 in 20 different cells
without repeating. Anyone?
Sean Timmons said:I assume you want a random whole number.
But RAND() in A2:A34, then do RANK(A2,A2:A34) and grab the first 20.
Shane Devenshire said:Actually I did test it, but keep in mind the key here is what range you
enter
in the RANDBETWEEN function, if you choose 1, and 64 bad news, if you
choose
0, and 1000000, its done in a second.
--
If this helps, please click the Yes button.
Cheers,
Shane Devenshire
T. Valko said:I'm curious to know if you tested that and, if so, how long did it take
to
get 64 unique random numbers?
--
Biff
Microsoft Excel MVP
Shane Devenshire said:If you like RANDBETWEEN here is another approach
Enter RANDBETWEEN in as many cells as you want, say A1:A64 then in B1
enter
=SUMPRODUCT(COUNTIF(A1:A64,A1:A64))=COUNT(A1:A64)
Now either press F9 until B1 = FALSE or run the following macro:
Sub myRand()
Do Until [B1]= TRUE
Activesheet.Calculate
Loop
End Sub
Of course, since RANDBETWEEN is volatile you need to copy and paste the
set
somewhere else as values.
--
If this helps, please click the Yes button.
Cheers,
Shane Devenshire
:
I am trying to return a Random number between 1:32 in 20 different
cells
without repeating. Anyone?
Jerm said:That worked, but how do I put in a new one for the next column?
The next one needs to be for 1-100.
I also give you the option of changing low.