The RANDARRAY function is a Math & Trigonometry formula that creates an array of randomly generated numbers. In this guide, we’re going to show you how to use the RANDARRAY function and also go over some tips and error handling methods.

The Dynamic Array functions can populate an array in a range of cells based on a formula. This behavior is called spilling and can help overcome the limitations of array formulas.

Supported versions






Optional. The number of rows of randomly generated numbers to be returned. The default value is 1.


Optional. The number of columns of randomly numbers to be returned. The default value is 1.


Optional. The minimum number to be returned. The default value is 0.


Optional. The maximum number to be returned. The default value is 1.


Optional. A Boolean value that specifies the type of numbers to return.

·         FALSE: Decimal number to 15 decimal places. (default)

·         TRUE: Whole number


Row/column only list



formulas return one-dimensional arrays. Entering only a [rows] argument populates an array that has a certain number of rows in a single column. To populate an array across columns, enter a value for the [columns] argument as well.

Row & column array

formula returns a two-dimensional array within the specified limits. While the values of the [rows] and columns] arguments (5 and 3 here) determine the size of return array, the [min] and [max] values specify the top and bottom limits for the random number generation.

Random Whole Numbers

formula users the [whole_number] parameter. Like in the previous example, a two-dimensional array of random numbers will be generated in specified limits. However, in this scenario the generated numbers numbers are whole numbers (integers).

Download Workbook


  • The RANDARRAY function is a volatile function. This means that it re-calculates the results with every calculation and this can affect the performance of the workbook.
  • If you enter nothing for the parameters, the RANDARRAY function acts like the RAND function.
  • You can use RANDARRAY as a substitute for the RANDBETWEEN. This requires omitting the [rows] and [columns] arguments and setting [whole_number] to TRUE. For example, to return values between 5 and 10, use
  • You can combine the RANDARRAY with the SORTBY function to shuffle an array of values.



If there isn’t enough space for adding the results below the formula, you will see a #SPILL! error. Excel marks the target range with dashed lines. Clear the contents of the cells in this range, and Excel will automatically update the results.


  • If the [min] is greater than or equal to the [max] you will get a #VALUE! error.
  • If any of the argument is not a numeric value, you will get a #VALUE! error.