ID EN
#Dynamic array

RANDARRAY

Excel Functions

Get array of random numbers

Syntax

EXCEL
=RANDARRAY([rows], [columns], [min], [max], [integer])

Arguments

Parameter Description
rows [optional] Row count. Default = 1.
columns [optional] Column count. Default = 1.
min [optional] Minimum value. Default = 0.
max [optional] Maximum value. Default = 1.
integer [optional] Whole numbers. Boolean, TRUE or FALSE. Default = FALSE.

Return Value

Array of random values

Details

The RANDARRAY function generates an array of random numbers between two values. The size or the array is determined by rows and columns arguments. By default, RANDARRAY returns an array of random numbers between 0 and 1. However, RANDARRAY will generate whole numbers when the integer argument is set to TRUE. When RANDARRAY returns multiple results in a worksheet, results will spill into adjacent cells. The RANDARRAY function takes five arguments, none of which are required: rows, columns, min, max, and integer. By default, rows, columns, and max default to 1, while min defaults to zero and integer defaults to FALSE. Without any arguments, RANDARRAY will return a decimal value between 0 and 1: Use rows and columns to control the number of values returned: Use min and max to set a lower and

Examples

Example 1

The RANDARRAY function takes five arguments, none of which are required: rows, columns, min, max, and integer. By default, rows, columns, and max defa

EXCEL
RANDARRAY() // returns number like 0.098419132
Example 2

Use rows and columns to control the number of values returned:

EXCEL
=RANDARRAY(10,1) //  10 random values in rows
=RANDARRAY(1,10) //  10 random values in columns
Example 3

Use min and max to set a lower and upper threshold for values. For example, to generate 3 random decimal values in rows between 1 and 5:

EXCEL
=RANDARRAY(3,1,1,5) // 3 decimal between 1-5
Example 4

Set integers to TRUE to return whole numbers. For example, to generate 3 random whole numbers in rows between 1 and 100:

EXCEL
=RANDARRAY(3,1,1,100,TRUE) // 3 whole numbers between 1-100
Examples

In the example shown, RANDARRAY is used to generate 50 values in a range of 10 rows by 5 columns. The formula in B4 is:

EXCEL
=RANDARRAY(10,5)
Examples

To return a random array of integers, 5 rows by 2 columns, between 1 and 10, you can use a formula like this:

EXCEL
=RANDARRAY(5,2,1,10,TRUE)

See Also

RAND RANDBETWEEN