View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ixtreme Ixtreme is offline
external usenet poster
 
Posts: 61
Default Random selection of records based on specifc value

I would like to create sample files based on the total number of
unique values in column A. I use a vlookup value to calculate the
required sample records I need.
Suppose I have column A containing the following information:

apples
peers
oranges
apples
peers
etc etc.

Then I calculate the unique values:
apples = 200
peers = 450
oranges = 50

then I calculate:
total samples needed = 100

then I calculate the samples needed based on the 'weight':
apples = (200 / 700) * 100 = 29
peers = (450 / 700) * 100 = 64
oranges = (50 / 700) * 100 = 7

Here comes the problem:

Through vba I automatically want to select 29 random 'apples' rows, 64
random peers rows and 7 random oranges rows and copy them to sheet2.

Mark