The RAND function is used in Google Sheets to generate a random decimal between 0 and 1. 0 is the lowest possible value, but the output must be lower than 1. There are no inputs, unlike most other functions in Google Sheets.
To produce a random integer, consider using the RANDBETWEEN. Get your copy of these examples in a live Google Sheet.
Contents
Purpose
This function returns a random decimal between 0 and 1.
Syntax
=RAND()
Similar Functions
RANDBETWEEN – Generates a random integer with a value between two numbers supplied to the function
RANDARRAY – Generates an array of random numbers
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.
Examples
Example 1 – Simple Use of the RAND Function
The RAND function does not need any inputs.
When you type =RAND()
into a cell, Google Sheets returns a random decimal value less than 1.
Example 2 – Creating Larger Decimals
Depending on the layout of your spreadsheet, you may want a larger random decimal than those created by the RAND function. This technique adds to the function, creating a small formula to enable a larger range of numbers.
=RAND()*(b-a)+a
To increase the output of the function, we multiply it by(b-a)+a
, which creates an output between a
and b
. To generate a random decimal between 7
and 13
, we use the formula below.
=RAND()*(13-7)+7
Live Examples in Sheets
Go to this spreadsheet for examples, along with RANDBETWEEN and RANDARRAY, that you can study and use anywhere you would like.
Notes
- The output of RAND changes whenever the spreadsheet changes or reloads (like TODAY, NOW, RANDARRAY, and RANDBETWEEN).
- If you want the output to be static, consider using Copy and then Paste special as a value.
- Avoid using too many RAND functions in your spreadsheet, as it can slow it down with the extra recalculations.
- To force the random number to be recalculated more frequently, go to the File -> Settings -> Calculations, then change the setting from On change to On change and every minute or On change and every hour.