ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help regarding random sampling (https://www.excelbanter.com/excel-programming/397014-help-regarding-random-sampling.html)

mecivil

Help regarding random sampling
 
I have to develop a user-defined function that can
be used to do random sampling of one or more elements from a sampling
frame listed in a range in Excel
When two or more elements are
sampled, the sampling needs to be done without replacement.

How can i achieve this?

DanR

Help regarding random sampling
 
Look for 'help' on Randomize and rnd
like below:
'Returns a random number from one(1) to nine(9)
Randomize
Random19 = Int(9 * Rnd + 1)

You will have to setup your own macro based on your sample.

DanR

"mecivil" wrote in message
...
I have to develop a user-defined function that can
be used to do random sampling of one or more elements from a sampling
frame listed in a range in Excel
When two or more elements are
sampled, the sampling needs to be done without replacement.

How can i achieve this?




Gary''s Student

Help regarding random sampling
 
In the simplest case, assume that all the elements are in a single column,
column A. If this is not true, then first move the elements to a single
column.

If column B enter:
=RAND() and copy down as far as column A

Sort both columns by column B. This will "shuffle" the elements in column A

Then just get the top set of elements from column A:
A1 thru A3 to sample three
A1 thru A7 to sample 7
etc.
--
Gary''s Student - gsnu200743


"mecivil" wrote:

I have to develop a user-defined function that can
be used to do random sampling of one or more elements from a sampling
frame listed in a range in Excel
When two or more elements are
sampled, the sampling needs to be done without replacement.

How can i achieve this?



All times are GMT +1. The time now is 11:13 PM.

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