Contact

RANDARRAY Function in Microsoft Excel: Syntax, Examples & Troubleshooting

Math Intermediate Microsoft Excel

Create random Excel arrays with RANDARRAY. Set dimensions, bounds and integer mode; check spill behavior, defaults and constraints without inventing fixed random outputs.

Verification status: See the evidence and test scope described in this guide. How formula examples are checked

Quick answer: RANDARRAY generates a rectangular array of random numbers. Specify row and column counts, minimum and maximum values, and TRUE for integer output or FALSE for decimal output. The results spill from the formula cell into surrounding cells in supported Excel versions.

Syntax and defaults

=RANDARRAY([rows],[columns],[min],[max],[whole_number])

Every argument is optional. The syntax calls the fifth argument whole_number; the help table also labels it integer. These refer to the same final Boolean switch, not a sixth argument.

Argument Purpose Omitted behavior
rows Output row count One row
columns Output column count One column
min Lower bound 0
max Upper bound 1
whole_number TRUE for integers, FALSE for decimals FALSE

Use positive integer dimensions for the examples. Microsoft states that the minimum must be less than the maximum and documents #VALUE! otherwise. The examples therefore avoid using equal bounds as a constant-array shortcut. =RANDARRAY() produces a single decimal value between the default limits rather than a large unspecified range.

Worked example: three days by two stores

A demonstration model needs two demand draws on each of three days.

  1. Leave B2:C4 empty.
  2. Enter =RANDARRAY(3,2,10,20,TRUE) in B2 and press Enter.
  3. The expected shape is 3 rows × 2 columns, occupying B2:C4.
  4. Each of the six outputs is expected to be an integer between 10 and 20.
  5. Enter =SUM(B2:C4) in E2. The expected constraint is 60 through 120.

There is no fixed expected six-number sequence. A sample such as rows (10,16), (13,20), (18,12) would satisfy the constraints and sum to 89, but it is merely an illustrative admissible array, not captured Excel output.

The formula lives only in the top-left anchor B2. Do not paste six separate RANDARRAY formulas into the intended spill range. To change the dimensions, edit the anchor formula and first ensure that the enlarged destination area is empty.

Second example: default decimal mode

Enter =RANDARRAY(4,1) in an empty column. The expected shape is four rows by one column, with decimal values between the default limits 0 and 1. It is not expected to return only zeroes and ones. To make a two-outcome integer simulation, explicitly use:

=RANDARRAY(4,1,0,1,TRUE)

Every value is then expected to be either 0 or 1, although repeated values and a column containing only one of those outcomes are possible. A tiny sample does not prove fairness or guarantee a balance of categories.

Advanced application: stress-test a fixed-size calculation

A worksheet that totals six demand inputs can be exercised with the 3-by-2 integer array above. Check shape with =ROWS(B2#) and =COLUMNS(B2#) in a dynamic-array build; expected results are 3 and 2. The # suffix refers to the whole spilled array anchored at B2.

Keep the output constraints beside the model: count 6, minimum at least 10, maximum at most 20 and total between 60 and 120. These are invariants, so they remain meaningful when random values change. A single exact total would not be a sound test for fresh random output.

For a stable example shared with a colleague, copy the generated area and paste values into a separate range. Retain the generating formula and input bounds nearby. A frozen snapshot no longer regenerates, whereas a live random formula is unsuitable when later recalculation must preserve a specific scenario. RANDARRAY has no seed parameter in its documented syntax.

Troubleshooting and compatibility details

  • #SPILL!: the destination must be able to expand into all requested rows and columns. Inspect occupied cells, merged cells and the placement of the formula before changing inputs.
  • #VALUE!: check the documented min-less-than-max requirement; do not reverse or equalize these bounds.
  • Unexpected decimals: supply TRUE as the fifth argument. Omitting it selects decimal output.
  • Repeated integers: random sampling can repeat; this function does not promise a shuffled set of unique numbers.
  • External-workbook #REF!: Microsoft documents limited cross-workbook dynamic-array support. Linked dynamic-array formulas require both workbooks open; closing the source can cause #REF! on refresh.
  • Unrecognized name: verify the target version. The current reference includes Microsoft 365, Excel 2024 and Excel 2021, but does not list Excel 2019 or 2016.

Compatibility and verification

Microsoft’s reference checked on October 17, 2026 lists: Excel for Microsoft 365 Excel for Microsoft 365 for Mac Excel 2024 Excel 2024 for Mac Excel 2021 Excel 2021 for Mac Excel for iPad Excel for iPhone Excel for Android tablets Excel for Android phones. Microsoft’s alphabetical catalog, checked October 17, 2026, identifies Excel 2021 as the introduction-version marker for RANDARRAY. This perpetual-release marker does not establish an earlier Microsoft 365 preview or rollout date. Platform restrictions remain separate. The last functioning version is unverified; no retirement is asserted.

Example verification: Expected numerical results are independently calculated; text and shape expectations follow the documented contract. These examples have not been tested in Microsoft Excel. No screenshot or native execution is claimed.