4.5 C
London
Thursday, December 19, 2024
HomeSoftware TutorialsGoogle SheetsHow to Select a Random Sample in Google Sheets

How to Select a Random Sample in Google Sheets

Related stories

Learn About Opening an Automobile Repair Shop in India

Starting a car repair shop is quite a good...

Unlocking the Power: Embracing the Benefits of Tax-Free Investing

  Unlocking the Power: Embracing the Benefits of Tax-Free Investing For...

Income Splitting in Canada for 2023

  Income Splitting in Canada for 2023 The federal government’s expanded...

Can I Deduct Home Office Expenses on my Tax Return 2023?

Can I Deduct Home Office Expenses on my Tax...

Canadian Tax – Personal Tax Deadline 2022

  Canadian Tax – Personal Tax Deadline 2022 Resources and Tools...

Often you may want to select a random sample from a dataset in Google Sheets. Fortunately this is easy to do using the RAND() function, which generates a random number between 0 and 1.

The following step-by-step example shows how to use this function to select a random sample in Google Sheets.

Step 1: Create a Dataset

First, we’ll enter the values of a dataset into a single column:

Step 2: Create a List of Random Values

Next, type =RAND() into cell B2. This creates a random value between 0 and 1.

Copy and paste this formula into every remaining cell in column B:

Step 3: Copy & Paste the Random Values

Next, highlight the values in column B and click Ctrl + C. This will copy all of the values. Next, right click on cell C2 and choose Paste special > Paste values only.

Note that the values in column B may change once you do this, but don’t worry about this.

Lastly, highlight the values in column C and drag them to replace the values in column B.

Step 4: Sort by the Random Values

Next, highlight cells A2:B16. Then click the Data tab along the top ribbon, then click Sort range.

Choose to sort by the values of Column B from A to Z, then click Sort:

The values will be sorted based on the random number, from smallest to largest:

Step 5: Select the Random Sample

Lastly, choose the first rows to be in your random sample. For example, if you want a random sample of size 5, then choose the first 5 raw data values to be included in your sample.

In this example, our random sample would include the first 5 values: 5, 20, 14, 13, 8.

Additional Resources

The following tutorials explain how to select a random sample from a dataset using other statistical software:

How to Select a Random Sample in Excel
How to Select a Random Sample in R
How to Select a Random Sample in Python

Subscribe

- Never miss a story with notifications

- Gain full access to our premium content

- Browse free from up to 5 devices at once

Latest stories