View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
DOR
 
Posts: n/a
Default How do I pull a random sample of people from a list in excel?

You can pull a random sample of N items from a column using this
technique:

Assuming your items are in A2:A100, enter in column B, a helper column,

=IF(RAND()<(SampSize-COUNT($B$1:B1))/(ROWS($A$2:$A$100)-(ROW()-ROW($2:$2))),ROW(),"")

where SampSize is the name of a cell containing the number of items you
want in your sample.

Drag/copy down to he end of your list.

In C2 enter

=IF(ROW()-ROW($1:$1)SampSize,"",INDEX(A:A,SMALL(B:B,ROW()-ROW($1:$1))))

Drag it down as far as you want, at least to cover the number of items
you want in your sample. You can drag it further; you should just get
blanks beyond your sample size.

SampSize is a variable, and can be changed at any time to give you a
different sized sample, as long as you have enough instances of the
formula in column C.

Hope this helps

Declan O'Riordan