Sheets Header

Google Sheets provides a simple function to generate random numbers inside your spreadsheet without having to leave the document or install an add-on. The function returns a random integer between two values. Here’s how to use it.

Fire up the Google Sheets homepage and open either a new or existing spreadsheet. For this guide, we’ll use the function RANDBETWEEN to produce a random number.

By default, the RANDfunction only generates a number between 0 (inclusive) and 1 (exclusive), whereas RANDBETWEEN lets you specify a range of numbers. While you could modify the function to generate other ranges, the RANDBETWEENfunction is a much simpler way to accomplish this.

RELATED: How Computers Generate Random Numbers

Click on a cell where you want to insert a random number and type =RANDBETWEEN(<Low>, <High>) but replace <Low> and <High> with the range in which you want the random number to fall.

For example, if you want a random number between 1 and 10, it should look like this:


Type the function in to a cell, enter the low and high end of the random range, and then press the Enter key.

After you fill in the range, press the Enter key. The random number will populate the cell where you entered the formula.

After you press Enter, the random number will appear in the cell.

If you want to use a number from another cell in your spreadsheet, all you have to do is enter the cell number instead of a low or high number.

Use data from other cells when you type in the cell number instead.

Note: Both RAND and RANDBETWEEN are considered volatile functions, meaning they don’t retain the data in the cell forever. So, when you’re using either of the functions, they recalculate a new number each time the sheet changes.

If you want to change the interval in which your random number is recalculated, open up File > Spreadsheet Settings, click on the “Calculation” tab, and then choose how often you want the function to recalculate from the drop-down menu.

You can select “On Change” (default), “On Change and Every Minute,” or “On Change and Every Hour.” Click “Save Settings” to return to your spreadsheet.

Profile Photo for Brady Gavin Brady Gavin
Brady Gavin has been immersed in technology for 15 years and has written over 150 detailed tutorials and explainers. He's covered everything from Windows 10 registry hacks to Chrome browser tips. Brady has a diploma in Computer Science from Camosun College in Victoria, BC.  
Read Full Bio »