How to Use the RANDARRAY Function to Randomly Sort Data in Excel
HomeHome > Blog > How to Use the RANDARRAY Function to Randomly Sort Data in Excel

How to Use the RANDARRAY Function to Randomly Sort Data in Excel

Sep 01, 2023

Want to add a little excitement to your data analysis? Learn how to use the RANDARRAY function to randomly sort your data in Excel.

There are many different functions available in Excel that make data transformation and organization easy. One of these functions is the RANDARRAY Function, which allows you to randomize your data efficiently in Excel.

The RANDARRAY function becomes very handy when working on tasks like randomly shuffling people into groups. This guide will take you through the RANDARRAY function, covering its definition, and how to use the function in Excel.

The RANDARRAY function in Excel is a dynamic array function that returns an array of random numbers based on the number of rows, columns, and minimum and maximum values you specify. The return values of dynamic array functions automatically spill into the surrounding cells.

The syntax of the RANDARRAY function is:

Where:

Since all the parameters in the RANDARRAY function are optional, it will return a value if only one argument is specified. Thus, you can return an array of numbers based on the number you set in either of these four arguments: rows, columns, min, and max. a value.

To get things started, let's use the RANDARRAY function in some partial examples on its own to grasp how it navigates the spreadsheet.

Suppose you want random data occupying five rows and four columns.

Your final syntax will be:

Once you press Enter, the formula will return random decimal numbers spread across five rows and four columns because you specified five for rows and four for columns in the formula. This means your formula worked!

Using the two other optional parameters, min and max, you can return a random array of numbers and specify the minimum and maximum number in the array.

Let's pick up where we left off from the last example. This time, we want the smallest number to be 20 and the largest to be 100.

The two examples before this returned decimal numbers because by default, if not specified, the RANDARRAY returns decimal numbers. To get whole numbers or integers, you have to specify TRUE for the integer argument in the formula.

Let's demonstrate this.

Notice that all the numbers are integers. That is what the TRUE in the formula does. If you change the TRUE to FALSE, the RANDARRAY function will return decimal numbers in your Excel spreadsheet.

The RANDARRAY function works well when it comes to producing random data. However, to sort the data, you will need to pair the RANDARRAY function with the SORTBY function in Microsoft Excel.

The syntax of the SORTBY function is:

Where:

Let's use a fresh example below to demonstrate how you can pair the RANDARRAY function with the SORTBY function in Excel. In this example, we have a list of ten names. We'll use the RANDARRAY to select the name randomly and the SORTBY to sort it.

Your final syntax will be:

You can use the evaluate feature to understand this Excel formula better.

The RANDARRAY function in Microsoft Excel is a versatile function that comes in handy in various situations. With it, you can randomize your data and effortlessly organize your data. You can pair it up with other Excel functions to maximize its potential and be more productive.

Ifeanyi is a skilled data analyst passionate about writing and open-source development. His expertise in data analysis is complemented by his exceptional technical writing and documentation skill. In addition, he actively contributes to open-source projects, bringing a collaborative spirit and a wealth of knowledge to the table.His goal is to make a positive impact in the tech industry.

rowscolumnsminmaxintegerTRUEFALSEB3.=RANDARRAY(5,54)EnterEnter20100B3EnterTRUEB3EnterTRUETRUEFALSEarrayby_arraysort_orderarray/orderD5SORTBY array SORTBY array by_array.