RANDARRAY FUNCTION is one of the very important and useful functions in GOOGLE SHEETS. It is an array function which can return multiple values in one go.
As RANDARRAY FUNCTION is concerned with the numbers , so it is present under the MATH FUNCTION CATEGORY of the functions.
RANDARRAY FUNCTION HELPS US TO CREATE AN ARRAY OR GRID OF RANDOM NUMBERS. IT IS JUST LIKE THE RAND() FUNCTION, BUT WILL RETURN A COMPLETE GRID OF RANDOM NUMBERS AT ONCE.
It finds out the exact same copy of the characters or text to be searched. It compares content as well as case of the text.
RANDARRAY FUNCTION is very useful in generating random numbers which are useful in the applications or formulas consisiting of NUMBER OF CHANCES or probability.
In this article we would learn about the purpose, syntax, formula of the RANDARRAY FUNCTION and get a better understanding with the help of the examples in GOOGLE SHEETS .
PURPOSE OF RANDARRAY FUNCTION IN GOOGLE SHEETS
RANDARRAY FUNCTION GENERATES A GRID OF RANDOM NUMBER WITH THE CUSTOM NUMBER OF ROWS AND COLUMNS.
if we are creating a game of random numbers which are needed in a grid i.e. with rows and columns just like a matrix, we can make use of randarray function easily.
Similarly we can create numbers random numbers with specified number of significant digits using the randarray function.
PREREQUISITES TO LEARN RANDARRAY FUNCTION
THERE ARE A FEW PREREQUISITES WHICH WILL ENABLE YOU TO UNDERSTAND THIS FUNCTION IN A BETTER WAY.
- Basic understanding of how to use a formula or function.
- Basic understanding of rows and columns in GOOGLE SHEETS .
- Some information about the RANDOM NUMBERS
- Of course, availability of internet and google sheets login.
SYNTAX: RANDARRAY FUNCTION
The Syntax for the RANDARRAY function is
=RANDARRAY ( NUMBER OF ROWS, NUMBER OF COLUMNS )
NUMBER OF ROWS is the number of rows of the grid of the random numbers which we want to create.
NUMBER OF COLUMNS is the number of rows of the grid of the random numbers we want to create.
Suppose we want to create a grid of 4×4 i.e. 4 rows and 4 columns random numbers, we can do it using the function =RANDARRAY (4,4)
EXAMPLES: RANDARRAY FUNCTION IN GOOGLE SHEETS
EXAMPLE TYPE 1: CREATE A GRID OF 20 RANDOM NUMBERS IN 4X5 GRID. [ 4 ROWS AND 5 COLUMNS ]
This example demonstrates a simple usage of RANDARRAY FUNCTION in google sheets.
Follow the steps to create the random numbers as required.
STEPS TO CREATE A GRID OF RANDOM NUMBERS IN GOOGLE SHEETS
- Select the cell where we want the first random number to be.
- Enter the formula as =RANDARRAY(4,5)
- Press ENTER.
- The google sheets will display the random number as shown below.
EXAMPLE TYPE 2: CREATE A GRID OF 60 [5×12] RANDOM NUMBERS BETWEEN 0 AND 50.
We already learnt to create a grid of the RANDOM NUMBERS using the RANDARRAY FUNCTION but this time we need to put a limit on the numbers.
Previously we already saw that the random numbers were generated within 0 and 1 .
We need to create the numbers up to 50.
The second issue is to create a whole number. We already saw that the random numbers generated have a number of decimal digits.
So keeping these facts in mind, follow the steps to create the pattern as desired.
STEPS TO CREATE A GRID OF 60 NUMBERS BETWEEN 0 AND 50:
- Select the cell where we want the first number to show.
- Enter the formula as =ARRAYFORMULA(INT(RANDARRAY(5,12)*50))
- Press ENTER.
- The result will appear as shown in the picture below.
- The EXPLANATION of the formula follow the picture.
Let us understand the working of the formula.
We used the formula =ARRAYFORMULA(INT(RANDARRAY(5,12)*50))
The first function used is the ARRAYFORMULA which lets us make the NON ARRAY FORMULAS AS ARRAY FORMULAS. In our expression INT function is a non array formula.
The INT function returns a whole number less than or equal to the NUMBER passed into INT. For example =INT(15.12) will return 15 , =INT(89.98) will return 89 and so on.
RANDARRAY as we already discussed in previous example, will create the grid of 60 elements between 0 and 1 so we multiplied it with 50 which will return us the numbers between 0 and 50.
Hence we achieve the result.