Exceljet

Quick, clean, and to the point

Excel RANDARRAY Function

Excel RANDARRAY function
Summary 

The Excel RANDARRAY function generates an array of random numbers between. The size or the array is is specified by rows and columns arguments. Generated values can be either decimals or whole numbers.

Purpose 
Get array of random numbers
Return value 
Array of random values
Syntax 
=RANDARRAY ([rows], [columns], [min], [max], [integer])
Arguments 
  • rows - [optional] Number of rows to return. Default = 1.
  • columns - [optional] Number of columns to return. Default = 1.
  • min - [optional] Minimum value to return. Default = 0.
  • max - [optional] Maximum value to return. Default = 1.
  • integer - [optional] Return whole numbers. Boolean, TRUE or FALSE. Default = FALSE.
Version 
Usage notes 

The RANDARRAY function is a "Dynamic array function". RANDARRAY returns an array of random numbers between 0 and 1. The size of the array is determined by supplied rows and columns arguments. The values generated by RANDARRAY can be either decimal values or whole numbers. 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:

RANDARRAY () // returns number like 0.098419132

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

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

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:

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

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

=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:

=RANDARRAY(10,5)

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

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

Random text

To generate a random letter between A-Z you can use the CHAR function with RANDARRAY:

=CHAR(RANDARRAY(1,1,65,90,TRUE))

You can also generate random text strings with RANDARRAY.

Random dates

To generate 5 random dates in the next year, you can use a formula that combines RANDARRAY with the EDATE and TODAY functions:

=RANDARRAY(5,1,TODAY(),EDATE(TODAY(),12),TRUE)
RANDARRAY is a new function available in Excel 365 only.

Download 100+ Important Excel Functions

Get over 100 Excel Functions you should know in one handy PDF.