Generating an Array of Random Numbers with RANDARRAY


August 25, 2022 - by

Generating an Array of Random Numbers with RANDARRAY

The syntax for RANDARRAY is =RANDARRAY([rows],[columns],[min],[max],[integer]). Notice that all five arguments are optional.

  • =RANDARRAY(10) generates 10 rows and 1 column of =RAND()
  • =RANDARRAY(,5) generates one row and five columns of =RAND()
  • =RANDARRAY(2,3,1,9,True) generates 2 rows and 3 columns of =RANDBETWEEN(1,9)

Traditionally, =RAND() returns a decimal greater than or equal to 0 and less than 1. Originally, RANDARRAY would only return RAND. A change in February 2019 added the Min, Max, and Integer arguments to allow RANDARRAY to simulate RANDBETWEEN.

=RANDARRAY(5,3) returns five rows and three columns of random decimals between 0 and 1.
Figure 636. Generating an array of 5 rows by 3 columns of random numbers.
The new version of RANDARRAY will return integers. =RANDARRAY(5,3,1,9,TRUE) returns 5 rows and 3 columns of random integers between 1 and 9.
Figure 637. Generating random integers between 1 and 9.



This article is an excerpt from Power Excel With MrExcel

Title photo by Markus Krisetya on Unsplash