Random Sampling in Excel

Posted by bonsvr on Super User See other posts from Super User or by bonsvr
Published on 2011-11-18T23:18:22Z Indexed on 2011/11/19 1:55 UTC
Read the original article Hit count: 560

Filed under:
|
|

I have an Excel sheet as follows:

 NO     NAME    AMOUNT
 1       A        50
 1       B        50
 2       A       100
 2       C       100
 3       D        70
 3       B        70
 4       A        30
 4       F        30
 5       C       150
 5       G       150
         .
         .
         .
         .

There are let's say 10,000 rows.

I want to get a random sample from rows. There are 2 conditions:

1. Sampling must be based on "NO" column.
2. Size of the sample is determined by the user: it can be %5, %10 or %20.

For example, one decides to randomly choose %20 of total rows in the above example:

The result is like:

 NO     NAME    AMOUNT
 2       A       100
 2       C       100
90       Z       500
90       E       500
         .
         .
         .
         .

There should be 2,000 rows.

I don't know whether my question is too specific. I am new to Excel VBA, and I faced a situation like this. Above process is about getting a random sample from an account ledger for auditing purposes.

© Super User or respective owner

Related posts about microsoft-excel

Related posts about excel-2010