Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
beccadawn0622
 
Posts: n/a
Default Random Sample Without Duplication

I have a macro that generates a random sample of data for me. However, I
always end up with duplicate rows. Here is my macro info:
Sub takeSample()
Randomize Timer
For SampleRow = 2 To 80
dataRow = 2 + Fix(466 * Rnd)
Worksheets("Data").Rows(dataRow).Copy
Worksheets("Sample").Rows(SampleRow).PasteSpecial
Next SampleRow
End Sub
Can anyone Help me write this so I can generate 50 samples from my list that
are not duplicated?

Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.misc
JE McGimpsey
 
Posts: n/a
Default Random Sample Without Duplication

Take a look at the method used he

http://mcgimpsey.com/excel/udfs/samplenoreplace.html


In article ,
"beccadawn0622" wrote:

I have a macro that generates a random sample of data for me. However, I
always end up with duplicate rows. Here is my macro info:
Sub takeSample()
Randomize Timer
For SampleRow = 2 To 80
dataRow = 2 + Fix(466 * Rnd)
Worksheets("Data").Rows(dataRow).Copy
Worksheets("Sample").Rows(SampleRow).PasteSpecial
Next SampleRow
End Sub
Can anyone Help me write this so I can generate 50 samples from my list that
are not duplicated?

Thanks!

  #3   Report Post  
Posted to microsoft.public.excel.misc
beccadawn0622
 
Posts: n/a
Default Random Sample Without Duplication

I can't figure out how to work this into my macro. The problem is i have
data that is in 5 columns. I need random sampling without duplicating the
data in column A but the whole row needs to be brought over to worksheet two.
Thanks!!

"JE McGimpsey" wrote:

Take a look at the method used he

http://mcgimpsey.com/excel/udfs/samplenoreplace.html


In article ,
"beccadawn0622" wrote:

I have a macro that generates a random sample of data for me. However, I
always end up with duplicate rows. Here is my macro info:
Sub takeSample()
Randomize Timer
For SampleRow = 2 To 80
dataRow = 2 + Fix(466 * Rnd)
Worksheets("Data").Rows(dataRow).Copy
Worksheets("Sample").Rows(SampleRow).PasteSpecial
Next SampleRow
End Sub
Can anyone Help me write this so I can generate 50 samples from my list that
are not duplicated?

Thanks!


  #4   Report Post  
Posted to microsoft.public.excel.misc
 
Posts: n/a
Default Random Sample Without Duplication

Hello,

If you take my UDF UniqRandInt() from www.sulprobil.com (or JE's
RandInt()), then you can, for example:

1. Select cells A2:A80 in sheet Sample and array-enter
=UniqRandInt(466) [enter with SHIFT + CTRL + ENTER]
2. Select cells B2:F80 in sheet Sampe and array-enter
=INDEX(Data!A2:E467,$A2:$A80,{1,2,3,4,5})

HTH,
Bernd

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Seed numbers for random number generation, uniform distribution darebo Excel Discussion (Misc queries) 3 April 21st 23 09:02 PM
How do I create a random sample from a list? swrath Excel Worksheet Functions 1 December 23rd 05 03:32 PM
Is it possible to do a random sample of non-numeric data in Excel? Terri G Excel Discussion (Misc queries) 4 December 15th 05 05:44 PM
How do I pull a random sample of people from a list in excel? PM Excel Worksheet Functions 6 November 29th 05 04:41 AM
Random Sampling Andrea Excel Discussion (Misc queries) 2 November 11th 05 09:52 AM


All times are GMT +1. The time now is 12:58 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"