View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.misc
Joe User[_2_] Joe User[_2_] is offline
external usenet poster
 
Posts: 905
Default unique name list

"CJ" wrote:
Excel 2003. I have a list of 40 names. I would
like to randomly select names without repeat
until all 40 names have been selected.


One way....

Suppose the 40 names are in A1:A40. Put =RAND() into B1:B40. Then put the
following formula into C1 and copy down through C40:

=INDEX($A$1:$A$40,RANK(B1,$B$1:$B$40))

If you do not want B1:B40 changing every time a cell is edited, see my
response in your thread "volatile v non-volatile".

Alternatively, if you are doing this one time or infrequently, set up B1:B40
as above. If you use the volatile RAND() function, you might want to copy
B1:B40 and paste-special-value over B1:B40. Then select A1:B40 and use Data
Sort to sort column B.


(The paste-special-value is not really necessary. Sort will work just fine.
But the volatile RAND() expression will cause B1:B40 to be recalculated when
Sort writes back the sorted values. So B1:B40 will no longer reflect the
order in A1:A40. No harm done. But it might be mystifying to the unwary
user.)