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.
This function returns a random decimal between 0 and 1.
RANDBETWEEN – Generates a random integer with a value between two numbers supplied to the function
RANDARRAY – Generates an array of random numbers
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.
To increase the output of the function, we multiply it by
(b-a)+a, which creates an output between
b. To generate a random decimal between
13, we use the formula below.
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.
- 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.