The simplest way to do this is to use the RANDBETWEEN function with the CHOOSE function.

Both approaches are explained below.

The CHOOSE function

TheCHOOSE functionreturns a value from a list of values using an index number.

Select Values in the Paste Special window

The index number is provided as the first argument, and the values to be selected follow.

For this, we can use the RANDBETWEEN function.

The RANDBETWEEN function

TheRANDBETWEEN functiongenerates a random number between two integers, provided as thebottomand thetop.

Select Values in the Paste Special window

CHOOSE with RANDBETWEEN

The behavior of RANDBETWEEN will work perfectly for this problem.

When the formula is copied down the column, RANDBETWEEN returns a random number between 1 and 3.

To force a recalculation, you’ve got the option to press the F9 key.

Select Values in the Paste Special window

However, instead of RANDBETWEEN, we use RANDARRAY, which can generate anarrayof random numbers in one step.

This saves us the step of telling RANDARRAY how many rows we need.

In this case, ROWS returns 100, because there are 100 rows in the range B5:B104.

Select Values in the Paste Special window

This array lands in cell F5 andspillsinto the range F5:F104.

INDEX however accepts the values all at once in the first argument, calledarray.

The CHOOSE function will not accept a range of values; it requires that values be provided separately.

Select Values in the Paste Special window

Note: the formulas on this page will create completely random groups.

One result is that the total number of rows assigned to each group will vary.

If it’s crucial that you assign random groups with a fixed size (i.e.

Excel formula: Randomly assign people to groups

randomly assign people to teams of 6), see the example onthis page.

RANDBETWEEN recalculates each time a worksheet is opened or changed.

The values provided to CHOOSE can include references.

Excel formula: Random number between two numbers

RANDARRAY Function

The Excel RANDARRAY function generates an array of random numbers between two values.

The size or the array is specified byrowsandcolumnsarguments.

The generated values can be either decimals or whole numbers.

Excel formula: Random date between two dates

ROWS Function

The Excel ROWS function returns the count of rows in a given reference.

Excel formula: Random text values

Excel formula: Random value from list or table

Excel formula: Random number from fixed set of options

Excel RANDBETWEEN function

Excel CHOOSE function

Excel RANDARRAY function

Excel ROWS function

Article image

Article image