ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Random Sample Without Duplication (https://www.excelbanter.com/excel-discussion-misc-queries/67082-random-sample-without-duplication.html)

beccadawn0622

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!

JE McGimpsey

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!


beccadawn0622

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!



[email protected]

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



All times are GMT +1. The time now is 07:42 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com