In Excel, the RANDARRAY function returns an array of random integers between any two values you give.
Syntax :
=RANDARRAY([rows], [columns], [min], [max], [whole_number])
Parameters :
Rows (optional) – specifies the number of rows to fill. If not specified, the default is one row.
Columns (optional) – identifies the amount of columns to fill. If omitted, the default is one column.
Min (optional) – the least possible random number to generate. If no value is provided, the normal value of 0 is used.
Max (optional) – the greatest possible random number to generate. If no value is supplied, the default value of 1 is used.
Whole number (optional) – specifies the kind of values to return:
-TRUE – whole numbers
-FALSE or omitted (as is the case by default) – decimal numbers
Example :
Assume you wish to fill a range of 5 rows and 3 columns with any random integers. To do this, set up the first two parameters as follows:
Rows is set to 5 since we want the results in 5 rows.
Columns is three because we want the results in three columns.
We keep all of the other inputs at their default settings and obtain the following formula:
=RANDARRAY(5, 3)
Enter it in the top left cell of the target range (A2 in our example), press the Enter key, and the results will be spread across the required number of rows and columns.
Ask Your Query