Install free

Guides

Random samples and random numbers in Google Sheets

Excel's ToolPak has two tools for randomness: Sampling picks values from a range, and Random Number Generation fills a range with numbers from a distribution. StatPak has both, with a seed option so you can get the same results again.

Draw a random sample

An auditor wants to check 5 of 20 invoices. The invoice numbers are in column A.

A
1Invoice
210401
310404
410407
510410
610413
710416
810419
910422
1010425
1110428
1210431
1310434
1410437
1510440
1610443
1710446
1810449
1910452
2010455
2110458
  1. Open Extensions, StatPak, Data Analysis and choose Sampling.
  2. Input range: A1:A21 with Labels in first row ticked.
  3. Sampling method: Random. Number of samples: 5.
  4. Random seed: 2026 (optional, see below). Click Run.
10428
10419
10440
10437
10410

As in Excel, random sampling draws with replacement: each pick is from the full list, so the same value can appear twice. If you need 5 different invoices, draw a few extra and drop repeats, or use the formula method below.

Periodic (systematic) sample

Choose Periodic with Period 4 to take every 4th value, starting with the 4th:

10410
10422
10434
10446
10458

Periodic sampling is useful for picking one point per cycle, for example the same quarter from each year of quarterly data.

Generate random numbers

To simulate test scores with mean 100 and standard deviation 15 for two groups of 8:

  1. Choose Random Number Generation.
  2. Number of variables: 2 (columns). Number of random numbers: 8 (rows).
  3. Distribution: Normal, Mean 100, Standard deviation 15.
  4. Random seed: 42. Click Run.
85.6575795.90461
72.3755982.88677
92.05849118.4289
95.9722372.9731
90.0100150.81384
108.4793115.051
122.5645105.7591
116.6494115.4542

The other distributions are Uniform (between two values), Bernoulli (0 or 1 with probability p), Binomial (successes in n trials), Poisson, Patterned (a repeating sequence such as 1, 1, 2, 2, 3, 3) and Discrete (values with probabilities you list in a two-column range).

What the seed does

With a seed, the same settings give the same numbers every time: running the example above again with seed 42 reproduces the table exactly. That lets a teacher, classmate or reviewer check your work. Leave the seed blank for a fresh set each run. The output is plain values, so it does not change when the sheet recalculates.

A seed reproduces results within StatPak. Excel uses a different random number generator, so the same seed in Excel gives different numbers.

With formulas

Sheets' random functions have no seed and recalculate after every edit. To keep a result, copy it and use Edit, Paste special, Values only.

Related guides