random sample

DFISHER269

New Member
Joined
Mar 26, 2002
Messages
1
When I use the data analysis tool in Excel and choose random sample. The return data (requesting 50 out of 68) returns duplicate
data. The input data contains a row numbered 1 to 68. I need unique 50 data samples.

In addition I had to create a col numbered 1 to 68 in order to use the random sample, and then use a vlookup on the output to associate the data that it corresponds to. Otherwise without the numbered col. it gives an error message of, ..."input data contains non numeric data". If I wanted a random sample of names how would this be accomplished?
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
This code will select a random item from a list in column "A." Each time the code is run from a hot-key or form button, it will add the new pick to the bottom of a labled list in column "B."

Sub myListR()
'Find a random name in a existing names list.
'Then adds it to an ongoing list.
'By Joe Was, 6/27/2001.

Dim myOrder As Range
Dim myName
Dim mySelect As Variant
Randomize
'Note: The "20" below is the ending ROW of your names list.
' The "1" below is the starting ROW of your names list.
mySelect = Int((20 * Rnd) + 1)

'Note: The "A" below is the column where your names list is.
myName = Range("A" & mySelect)

'Put the answer in the next empty cell, bottom of list, one column Right.
'Make sure column "B" has a data lable for the list to start under!
Worksheets("Sheet1").Range("B65536").End(xlUp).Offset(1, 0) = myName

End Sub

Hope this helps.JSW
 
Upvote 0

Forum statistics

Threads
1,214,614
Messages
6,120,520
Members
448,968
Latest member
Ajax40

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top