This tutorial presents several methods to insert a column of random numbers into your spreadsheet. Feel free to make a copy of the spreadsheet used in this tutorial to follow along.
Contents
Producing One Column of Decimals
First, let’s start with a column on its own, and we will make it five rows tall.
=RANDARRAY(5)
The RANDARRAY function is the most important in this tutorial. It allows the spreadsheet to write multiple random numbers from one formula. In this case, the formula is only in cell A1. However, RANDARRAY fills cells A1 through A5 all from the formula in A1.
If the random decimals are sufficient for your use, you may have finished your formula at this point. However, if you want a more complete solution, let’s make the function control the number of rows.
⚠️ Keep in mind that RANDARRAY is a volatile function. This volatility means that its output changes every time you load the spreadsheet or change the data. If you want the random numbers to stay the same, you need to copy them and then paste them as values.
Matching the Number of Rows in an Existing Table
Now, let’s say you have an existing table and want to insert a random number in every row.

The function needs to count the number of rows to make this work. To perform the count automatically, we add the COUNTA function, which counts the values in the given cell range and returns 6 in this example. Since COUNTA returned a 6, the RANDARRAY uses this value as its input and returns 6 rows of random numbers.
=RANDARRAY(COUNTA(B2:B7))
Now, we have random decimals for every row. Let’s turn those decimals into integers.
Skip the functions and use the Random Sampler Google Sheets add-on. This user-friendly tool creates random samples without formulas. Choose from simple, systematic, or stratified sampling techniques.
Changing the Random Decimals to Integers
If you want the random numbers to be integers instead of decimals, we need to add a few more functions to the formula.
First, we’ll multiply the result of RANDARRAY(COUNTA(B2:B7)) by 100 to move the random numbers’ decimal points to the right two places.
After multiplying, we have numbers like 35.42382 instead of .3542382. The random number is large enough now, but we must remove the decimals. We can remove the decimals with the INT function, which rounds a number down to the nearest integer. However, we now have another problem. INT does not deal with arrays.
Therefore, you must precede INT with the ARRAYFORMULA function to allow INT to output an array. Don’t worry if that doesn’t make sense. You can copy and paste!

=ARRAYFORMULA(INT(RANDARRAY(COUNTA(B2:B7))*100))
Now, we have a formula that creates six random decimals with the correct number of rows to match your data.
Video Tutorial
Related Tutorials
-
SUMIF Function – Google Sheets
The SUMIF function is used in Google Sheets to add numbers if data meets a specific condition. Use SUMIFS to check for multiple conditions. Feel free to copy the template with these examples to follow along. Contents1 Purpose2 Syntax3 Related Functions4 Video Tutorial5 Common Error6 Examples6.1 Example 1 – Sum Values Greater Than or Equal to an…
-
Understanding Data Types in Google Sheets
Learn about the different types of data you can use in a spreadsheet.
-
Use Named Ranges to Simplify your Formulas
Named ranges give an alternate name to a cell or range of cells. You can then use them in your formulas to make the formulas easier to read. As you can see in the image below, the range of Sheet1!F5:F1007 has been named LemonVariety. The named range makes the formula easier to read and more…
