XL.Random function: generate an array of unique random numbers
XL.Random function – Array function type – generates an array of random numbers. Supports the ability to generate a unique set of random numbers.
XL.Random function helps avoid the limitations of the standard Excel functions like RANDARRAY and RANDBETWEEN:
- The function is not volatile, i.e. values will not be recalculated every time you make changes in your spreadsheet
- Makes it easy to generate an array of unique random numbers
Before you begin, add Functions to Excel
Functions are one of the 20+ features within XLTools Add-in for Excel. Works in Excel 2019, 2016, 2013, 2010, desktop Office 365.
Download XLTools for Excel
Syntax
=XL.Random(from, to, unique)
Argument | Description |
---|---|
from [required] | The smallest integer that the function will return |
to [required] | The largest integer that the function will return |
unique [optional] | Return a unique array of numbers:
|
Examples [download]
Download this spreadsheet with examples and try the function yourself.
Download examples with this function (xlsx)
Formula | Description |
---|---|
{=XL.Random(1,22,TRUE)} | Fill the array with unique random numbers from 1 to 22 |
{=XL.Random(1,22)} | Fill the array with random numbers from 1 to 22. Numbers are not unique and can repeat. |
Any questions or suggestions?