In this article we will show you how to create a random number generator in google sheets in just a few clicks using the RAND function. Simply follow the steps below.
Select the cell where you want to place the random number generator. You can format your spreadsheet in advance.
We use the RAND function combined with to insert a random number generator to the selected cell. The syntax is
=INT(RAND()*number)
Where number is the largest number you want the random number generator to output and INT rounds off the output to the nearest whole number. For example, if you want the largest number to be 10, the formula will be:
=INT(RAND()*10)
When you press enter, the resulting output will be a random number ranging from 0 to 10.
The formula recalculates whenever you make any change in the contents of the sheet.
If you want the function to automatically recalculate, follow the next step.
To set RAND to recalculate every minute or hour, change the recalculation settings of the sheet. Click File then select Settings.
A box labeled Settings for this spreadsheet appears.
Select the Calculation tab.
Click the drop-down list, then select On change and every minute or On change and every hour, whichever is the best for your need.
Click Save settings.
The RAND function will now recalculate every minute or every hour.
You can insert something close to a button so you can just click to generate a random number instead of trying to edit a cell just to make it generate new numbers. Here are the steps:
First, you need to insert the random number generator. The formula is straightforward:
=INT(RAND()*number)
Where number is the largest number you want the random number generator to output and INT rounds off the output to the nearest whole number. For example, if you want the largest number to be 10, the formula will be:
=INT(RAND()*10)
Format the sheet then select a cell where you want the formula placed.
Here is the result:
You can format your sheet to determine where to best place the button.
Once you select where to place the button, click Insert then select Checkbox.
You have now inserted a button! It’s not exactly a button but a checkbox. However, whenever you click the checkbox, you actually change the value of the cell containing it. Whenever you add a value or remove one from one of the cells, it forces the sheet to recalculate, making the RAND function give you a new value.
Here is a screencap to see that this trick works:
If you enjoyed this article, you might also like our article on how to find the mean on Google Sheets or our article on how to change column width in Google Sheets.
If you want to get a copy of our Google Sheets address book template, we also suggest checking out our detailed guide.