Function · Dynamic arrays
Excel RANDARRAY function
The Excel RANDARRAY function spills random numbers and calculates a new set whenever the workbook calculates. The four integers on this page are one pictured draw from 1 through 50, not a result you can reproduce.
Syntax =RANDARRAY([rows], [columns], [min], [max], [whole_number])
=RANDARRAY(4,1,1,50,TRUE)Arguments
| Name | Required | What to pass |
|---|---|---|
| rows | Optional | How many rows. The default is 1. |
| columns | Optional | How many columns. The default is 1. |
| min | Optional | The smallest value. The default is 0. It is included. |
| max | Optional | The largest value. The default is 1. For decimals, max is not included. For whole numbers, max is included. |
| whole_number | Optional | TRUE returns integers. FALSE, the default, returns decimals. |
Examples
Four whole numbers from 1 through 50, frozen for the picture
=RANDARRAY(4,1,1,50,TRUE)Result 17, 42, 8, and 33 in this picture
| A | |
|---|---|
| 1 | 17 |
| 2 | 42 |
| 3 | 8 |
| 4 | 33 |
RANDARRAY spills a block of random numbers. Four whole numbers from 1 through 50 can be any integers in that range, and both ends can come up. The grid shows 17, 42, 8, and 33. Those are one pictured draw. Nothing in the formula asks for them, and the next calculation replaces them.
Decimals are the default. RANDARRAY(4) spills four decimals from 0 up to, but not including, 1, the same rule as RAND. Whole numbers include the maximum, the same rule as RANDBETWEEN. Paste values before you sort or share the draw. Excel 2019 does not have RANDARRAY. A blocked spill is #SPILL!.