Skip to Content

How to Use the RANDARRAY Function in Google Sheets

If you need to generate an array with random numbers in your spreadsheet, the RANDARRAY function will come in handy.

This is an array version of the RAND function which generates random numbers between 0 and 1.

In this tutorial, I will show you how to use the RANDARRAY function in Google Sheets

RANDARRAY Syntax

The RANDARRAY function will generate a random array of numbers between 0 and 1. The size of the generated array depends on the number of rows and columns you place within the arguments of the function.

The syntax of this function is:

=RANDARRAY(rows, columns)

  • rows – the number of rows to return. This is an optional argument
  • columns – the number of columns to return. This is an optional argument

Notes about using this function:

  • If you leave out the rows and columns arguments the function will return a random number in only one cell (a 1×1 grid)
  • Hitting enter will cause the results of the function to update and generate randomly again

Using RANDARRAY

Using the RANDARRAY function is pretty easy. Again you are only putting in the number of rows and columns you want to return by the function.

Here is an example of the function used to return a 2×2 array:

RANDARRAY-example-1

The formula used is =RANDARRAY(2,2). This will return 2 rows and 2 columns.

Here is another example that returns a 5×3 array:

RANDARRAY-example-2

The formula in this one is =RANDARRAY(5,3). This returns 5 rows and 3 columns.

Even though RANDARRAY only returns values between 0 and 1, you can combine this with ARRAYFORMULA and basic multiplication to return even greater values.

Here is an example of using this to return numbers between 0 and 100:

RANDARRAY-example-3

The formula used in this example is:

=ARRAYFORMULA(RANDARRAY(5,3)*100)

This will take all the values returned by the RANDARRAY and multiply them by 100. From here you can round up or down if you only wish to return whole numbers.

Closing Thoughts

The RANDARRAY function is useful when you want to return an array or table of random numbers.

Even though the function only returns values between 0 and 1, you can combine it with other functions like ARRAYFORMULA and multiply by the randomly generated numbers to return greater numbers if desired.

With the only arguments of the function being the number of rows and columns to return, this is an easy function to use, and it opens up a lot of possibilities when combining it with other functions.

More Google Sheets Tutorials:
How to Randomize a List
How to Use ARRAYFORMULA