RANDARRAY function

The RANDARRAY function in Excel generates an array of random numbers between 0 (inclusive) and 1 (exclusive) or within a specified range. This function is available in Excel 365, Excel 2021, and later versions that support dynamic arrays.


Syntax

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

Parameters

  1. rows (optional): The number of rows in the array. Default is 1.
  2. columns (optional): The number of columns in the array. Default is 1.
  3. min (optional): The minimum value for the random numbers. Default is 0.
  4. max (optional): The maximum value for the random numbers. Default is 1.
  5. integer (optional): Whether to generate integers (TRUE) or decimals (FALSE). Default is FALSE.

Key Features

  • Dynamic Array Function: Automatically spills values into adjacent cells based on the specified rows and columns.
  • Flexible Range: Allows custom ranges for random number generation.
  • Integer Option: Can generate whole numbers by setting the integer argument to TRUE.

Examples

  1. Generate a 3×3 array of random decimals between 0 and 1:
    =RANDARRAY(3, 3)
    
  2. Generate a 5×2 array of random integers between 10 and 50:
    =RANDARRAY(5, 2, 10, 50, TRUE)
    
  3. Generate a single random decimal number:
    =RANDARRAY()
    
  4. Generate a 4×4 array of random numbers between -5 and 5:
    =RANDARRAY(4, 4, -5, 5)
    

Tips

  • Use RANDARRAY when you need multiple random numbers in one formula.
  • If the results should not change, copy the array and paste it as values.
  • Combine RANDARRAY with other functions for advanced scenarios, such as simulating data or random sampling.
Leave a Reply 0

Your email address will not be published. Required fields are marked *