RANDARRAY Function

Excel Functions › Math & Trig

Excel 365 Math & Trig

The Excel RANDARRAY function returns a spilled array of random numbers with the rows, columns, range, and whole-vs-decimal behavior you choose — a single formula that fills a whole block of cells.


Quick answer:
=RANDARRAY(2, 3) a 2-row by 3-column array of random decimals 0-1

Syntax

=RANDARRAY([rows], [columns], [min], [max], [whole_number])
ArgumentDescription
rowsOptionalNumber of rows to return. Defaults to 1.
columnsOptionalNumber of columns to return. Defaults to 1.
minOptionalThe smallest value to return. Defaults to 0.
maxOptionalThe largest value to return. Defaults to 1.
whole_numberOptionalTRUE returns whole numbers; FALSE (default) returns decimals.

How to use it

RANDARRAY is the Excel 365 dynamic-array version of RAND. A single formula spills a block of random numbers across as many rows and columns as you ask for.

=RANDARRAY(2, 3) // 2x3 block of random decimals 0-1

Add min, max, and whole_number to control the values. Setting the fifth argument to TRUE returns integers within your range:

=RANDARRAY(3, 1, 1, 6, TRUE) // 3x1 column of whole numbers 1-6

Like RAND, RANDARRAY is volatile — the whole spill range refreshes on every recalculation. It needs empty cells below and to the right to spill into, otherwise it returns a spill error.

Tip: Pair RANDARRAY with SORTBY to shuffle a list, or with SEQUENCE to build randomized sample tables in one formula.

Try it: interactive demo

Live demo

Pick a RANDARRAY example to see the formula and its result.

Result:

Practice workbook

📊
Download the free RANDARRAY practice workbook
Every example on this page, ready to open in Excel — plus practice challenges with answers on a separate tab. No sign-up required.

Frequently asked questions

What does RANDARRAY return by default?
With no arguments, =RANDARRAY() returns a single random decimal between 0 and 1, just like RAND. Add rows and columns to spill a larger block.
How do I get whole numbers from RANDARRAY?
Set the fifth argument, whole_number, to TRUE and supply a min and max. =RANDARRAY(3,1,1,6,TRUE) returns a 3-cell column of whole numbers from 1 to 6.
Why do I get a #SPILL! error?
RANDARRAY needs the cells below and to the right of the formula to be empty so the array can spill. Clear those cells, or move the formula to open space.
Is RANDARRAY available in older Excel?
No — it is a dynamic-array function introduced in Excel 365 (and Excel 2021). In earlier versions, use RAND or RANDBETWEEN copied across a range instead.

Master functions like this in one day

This page covers one function. Our Excel Formulas and Functions class covers the 30 that matter most — live, hands-on, taught by professionals in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.

See the Formulas & Functions Class

Related functions: RAND · RANDBETWEEN · SEQUENCE · SORTBY · INT