RANDARRAY Function

The RANDARRAY function in Excel generates an array of random numbers. It’s a versatile function that can produce random numbers with specified dimensions and within a specific range. You can also choose to generate either whole numbers or decimals, making it useful for simulations, random data generation, and more.

Syntax

FunctionDescription
RANDARRAY([rows], [columns], [min], [max], [integer])Generates an array of random numbers based on the specified parameters.

Parameters

  • rows: (Optional) The number of rows in the array. The default is 1.
  • columns: (Optional) The number of columns in the array. The default is 1.
  • min: (Optional) The minimum number for the random range. The default is 0.
  • max: (Optional) The maximum number for the random range. The default is 1.
  • integer: (Optional) Determines whether the numbers are whole numbers (TRUE) or decimals (FALSE). The default is FALSE (decimals).

Example

In this example, let’s generate a 3x4 array of random integers between 10 and 50.

RowCol 1Col 2Col 3Col 4
123461738
215294013
350123421

Task: Generate a 3x4 array of random integers between 10 and 50.

To do this, use the RANDARRAY function like this:

=RANDARRAY(3, 4, 10, 50, TRUE)

This formula generates an array of random whole numbers between 10 and 50 with 3 rows and 4 columns.

Practice Exercise 1

Task: Generate a 5x5 array of random decimal numbers between 0 and 1.

Practice Exercise 2

Task: Generate a 4x3 array of random integers between -100 and 100.

Solution for Exercise 1

To generate a 5x5 array of random decimal numbers between 0 and 1:

=RANDARRAY(5, 5)

This formula generates a 5-row by 5-column array of random decimal numbers between 0 and 1.

Solution for Exercise 2

To generate a 4x3 array of random integers between -100 and 100:

=RANDARRAY(4, 3, -100, 100, TRUE)

This function creates a 4-row by 3-column array of random whole numbers between -100 and 100.