Sampling data

Use sampling to draw a random selection of rows from an open Add-In for Excel table and output it to a new Add-In for Excel table for further investigation. Individual rows are drawn only once and do not repeat.

How it works

When you draw a sample, a number called a random seed is required as a starting point for the random number generation that underlies sampling. Add-In for Excel can generate the random seed automatically, or you can choose to specify the random seed yourself. The seed value you specify can be any number.

Note

Add-In for Excel uses the Microsoft .NET System.Random class as its random number generator. For more information, search the class name on the Microsoft Developer Network.

Reproducing the sample

Specifying a random seed allows you to enter the same seed value later to produce an identical random sample from the unchanged data set. Reproducing a random sample could be a required part of repeating and verifying the investigation.

Retrieving the seed value from the table history

The sample size and the seed value are recorded in the history of the output Add-In for Excel table. If required, you can retrieve an automatically generated seed value from the table history and enter it manually as part of reproducing a random sample.

Generate a random sample

  1. With a cell selected in an Add-In for Excel table, click the ACL Add-In tab and select Sample.
  2. Specify the Number of samples you want drawn from the data.

    The number of samples cannot exceed the number of rows in the table.

  3. Under Random seed, select one of the following:
    • Generate seed value automatically Add-In for Excel generates the seed value
    • Seed value enter a number to use as the seed value

      Tip

      If the data set and the number of samples are unchanged, entering the same seed value later produces an identical random sample.

  4. In ACL Add-In worksheet name, accept the default Add-In for Excel worksheet name or enter a new name and then click OK.

Result the random sample of rows appears in a new Add-In for Excel table.