Skip to main content

RANDARRAY() Function in Excel: Generate Random Numbers in Your WorkBook

Generate random numbers in Excel easily with the RANDARRAY() function. Learn how to use RANDARRAY() to create dynamic arrays of random numbers for your spreadsheets.
Aug 8, 2025  · 3 min read

Random numbers play a key role in simulations, sampling, and many other things. If you’re working in Excel and need random numbers, the RANDARRAY() function is the first function you need to know. 

In this guide, you’ll learn how to use RANDARRAY() to build dynamic arrays of random numbers and customize them for your needs, whatever they are. 

What Is the RANDARRAY() Function in Excel?

The RANDARRAY() function in Excel allows users to generate an array of random numbers. This function is especially useful for simulations, sampling, or whenever you need a set of random values in your worksheet. Like, for example, if you were trying to create stratified random samples to test an experiment in your company, you might use RANDARRAY().

Key Features of Excel’s RANDARRAY()

Before diving into usage, it's important to understand the main features of RANDARRAY() in Excel:

  • Generates an array of random numbers
  • Allows specification of the number of rows and columns
  • Supports setting minimum and maximum values
  • Can generate either whole numbers or decimals
  • Updates automatically when the worksheet recalculates

Syntax of RANDARRAY()

The syntax for the RANDARRAY() function in Excel is as follows:

=RANDARRAY([rows], [columns], [min], [max], [whole_number])
  • [rows]: Number of rows to fill

  • [columns]: Number of columns to fill

  • [min]: Minimum value (optional)

  • [max]: Maximum value (optional)

  • [whole_number]: TRUE for whole numbers, FALSE for decimals (optional)

How to Use RANDARRAY() in Excel

Now that I mentioned the features and syntax, let's get to the important thing, which is how to use. Just follow these steps:

  • Select the cell where you want the random numbers to start

  • Enter the RANDARRAY() formula with your desired parameters

  • Press Enter to generate the array

For example, to generate a 3x2 array of random whole numbers between 1 and 100:

=RANDARRAY(3, 2, 1, 100, TRUE)

RANDARRAY() function in Excel simple example

This will fill a 3-row by 2-column range with random integers from 1 to 100.

Customizing Your Random Arrays

You can customize the output of RANDARRAY() in Excel by adjusting its arguments. Here are some common scenarios.

To generate decimals between 0 and 1 in a 5x1 array:

=RANDARRAY(5, 1)

RANDARRAY() function in Excel with decimals

To generate whole numbers between 10 and 50 in a single column with 10 rows:

=RANDARRAY(10, 1, 10, 50, TRUE)

RANDARRAY() function in Excel with whole numbers

To create a 4x4 grid of random numbers between 100 and 200:

=RANDARRAY(4, 4, 100, 200)

RANDARRAY() function in Excel for a grid of numbers

How RANDARRAY() Is Different from Other but Similar Excel Functions

Understanding the differences between RANDARRAY() and other Excel random number functions helps you choose the right tool for your needs.

  • RAND(): Generates a single random decimal between 0 and 1

  • RANDBETWEEN(): Generates a single random integer between two values

  • RANDARRAY(): Generates an array of random numbers, with options for size, range, and type

This makes RANDARRAY() the most flexible option when you need multiple random numbers at once.

Tips for Using RANDARRAY() in Excel

When working with RANDARRAY() in Excel, keep these tips in mind:

  • The array updates every time the worksheet recalculates, so values will change unless you copy and paste as values

  • Combine with other functions like SORT() or UNIQUE() for advanced randomization

  • Use the optional arguments to control the type and range of numbers generated

Conclusion

The RANDARRAY() function in Excel is a powerful tool for generating random numbers in a flexible and dynamic way. By understanding its syntax and options, you can quickly create arrays of random values tailored to your needs. Whether for simulations, sampling, or data analysis, RANDARRAY() makes random number generation in Excel easier than ever.

Keep learning with us. Take our Data Analysis in Excel course to keep improving your skills as a data analyst.


Josef Waples's photo
Author
Josef Waples

I'm a data science writer and editor with contributions to research articles in scientific journals. I'm especially interested in linear algebra, statistics, R, and the like. I also play a fair amount of chess! 

Topics

Learn with DataCamp

Course

Data Preparation in Excel

3 hr
67.2K
Understand how to prepare Excel data through logical functions, nested formulas, lookup functions, and PivotTables.
See DetailsRight Arrow
Start Course
See MoreRight Arrow
Related

Tutorial

Excel Random Number Generator: 3 Different Methods

There are multiple ways to generate random numbers in Excel, such as the `RAND(),` `RANDBETWEEN(),` and `RANDARRAY()` functions.
Laiba Siddiqui's photo

Laiba Siddiqui

Tutorial

Excel SEQUENCE(): A Helpful Guide to Dynamic Arrays

Master the `SEQUENCE()` function to supercharge your spreadsheet skills. Learn how to create dynamic lists, automate calculations, and unlock new Excel possibilities.
Josef Waples's photo

Josef Waples

Tutorial

Excel ROUND(): The Complete Guide to Rounding in Excel

Learn how to use the ROUND() function and its alternatives in Excel. Learn how to round decimals, integers, and time values.
Allan Ouko's photo

Allan Ouko

Tutorial

Excel INDIRECT(): How to Build Dynamic References in Your Formulas

Discover how Excel's INDIRECT() function transforms text into live references. Learn how to use it for dynamic worksheets, stable cell references, named ranges, and more.
Allan Ouko's photo

Allan Ouko

Tutorial

AVERAGE() in Excel: An Essential Function Explained

Learn to work with Excel’s AVERAGE() function, including conditional and logical variations.
Josef Waples's photo

Josef Waples

Tutorial

Rank Formula in Excel: A Comprehensive Guide With Examples

Learn how to rank data in Excel with RANK(), RANK.EQ(), and RANK.AVG() functions. Understand their differences, applications, and tips for accurate data analysis.
Laiba Siddiqui's photo

Laiba Siddiqui

See MoreSee More