RANDARRAY(rows, columns)One free generation or explanation per browser, shared across Excel and Google Sheets. Account usage limits apply afterward.
rows:
The number of rows to return in the array.
columns:
The number of columns to return in the array.
The RANDARRAY function in Google Sheets is a dynamic array function that generates an array of random numbers. This function allows users to create a specified number of random values in a defined range, making it a useful tool for simulations, random sampling, and various statistical analyses. Unlike the traditional RAND function, which only generates a single random number, RANDARRAY can produce multiple random numbers at once.
In simpler terms, RANDARRAY lets you quickly fill a range of cells with random numbers, saving you time and effort in generating data for testing or analysis.
Imagine you are conducting a survey and want to randomly assign participants to different groups for an experiment. You need to generate random numbers to represent these groups.
| ParticipantID | Group |
|---|---|
| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 |
You want to assign each participant to one of three groups (1, 2, or 3) randomly.
To achieve this, you would use the RANDARRAY function as follows:
=RANDARRAY(5, 1, 1, 3, TRUE)In this formula:
5 is the number of rows you want to fill (one for each participant).1 is the number of columns you want to fill.1 is the minimum value of the random numbers (the lowest group number).3 is the maximum value of the random numbers (the highest group number).TRUE indicates that the function should return whole numbers.When you apply the RANDARRAY formula to the Group Assignment Table, the output might look like this:
| ParticipantID | Group |
|---|---|
| 1 | 2 |
| 2 | 1 |
| 3 | 3 |
| 4 | 2 |
| 5 | 1 |
Each time you refresh the sheet or make changes, the group assignments will change, providing a new random distribution.
RANDARRAY is beneficial because it simplifies the process of generating random numbers in Google Sheets. It allows for the creation of multiple random values in one go, which is particularly useful for simulations, randomized experiments, and data analysis. Additionally, since the values are dynamic, they automatically update whenever the sheet recalculates, ensuring you always have fresh data.
RANDARRAY is an essential function for anyone working with data in Google Sheets, providing a straightforward way to enhance data generation and analysis capabilities.
Happy spreadsheeting!
You have a table of sales data, and you want to randomly select 5 sales representatives for a bonus draw. Use the RANDARRAY formula to generate random numbers, then sort the list to easily pick the top 5 representatives based on their random scores.
Sign up for Better Analyst and get unlimited AI-powered formula generation, explanations, and advanced data analysis.
Browse our complete library of Google Sheets formula guides
Compare your options
Open a neutral research prompt in the AI tool you already use. Compare capabilities, limitations, and fit before you choose.
AI answers can be incomplete. Check source links, current pricing, and product documentation before deciding.