View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
joeu2004 joeu2004 is offline
external usenet poster
 
Posts: 2,059
Default Random Sampling - Please Help!

On Jul 15, 6:18*am, Lee Mathew
wrote:
I would like to make a sample of 50 non-consecutive numbers. But
everytime i do a sample, i get duplicate numbers. Could you please tell
me a way where I could make a sample without duplicate numbers.


It is unclear whether you want a sampling from a specific set of (non-
consecutive) numbers that you have chosen, or from an arbitrary set of
non-consecutive numbers over some unspecified range. It is also
unclear whether the sample size or the "population" (from which you
sample) is 50.

To sample from a specific set of numbers, does the following meet your
needs?

Assume that you want a sample of 5 numbers in A1:A5 from a set of 50
numbers.

Put the numbers in consecutive rows in some column, for example
Y1:Y50. In some other column (e.g. Z1:Z50) put the formula =RAND().
Enter the following formula into A1 and copy down through A5:

=index($Y$1:$Y$50, rank(Z1, $Z$1:$Z$50))

If you do not like the fact that the values change every time you
modify the worksheet (argh!), copy-and-paste-special-value the random
values in Z1:Z50.