FormulaCamp
Completed
← Google Sheets functions
Google Sheets function

RANDBETWEEN in Google Sheets

In Google Sheets the bounds of RANDBETWEEN are both inclusive, and the value changes whenever the sheet recalculates.

Syntax (same in Google Sheets)

RANDBETWEEN(bottom, top)

Under File, Settings, Calculation you can choose to recalculate on change only, or also every minute or every hour.

For a fuller explanation of the arguments and common errors, see the RANDBETWEEN Excel guide.

Worked examples in Google Sheets

Fixed bound for a stable example

AB
1BottomTop
255

Formula: D2: =RANDBETWEEN(A2,B2)

Result: 5

Equal bounds make the only possible random result five.

Result respects its bounds

AB
1BottomTop
211

Formula: D2: =AND(RANDBETWEEN(A2,B2)>=A2,RANDBETWEEN(A2,B2)<=B2)

Result: TRUE

The degenerate interval verifies the inclusive boundary without relying on a changing value.

Negative fixed bound

AB
1BottomTop
2-3-3

Formula: D2: =RANDBETWEEN(A2,B2)

Result: -3

Negative integer bounds are accepted.

Try it

A tiny spreadsheet with example data. Edit the formula or any number and see the result.

Formula in D2: =RANDBETWEEN(1,100)

Example spreadsheet for RANDBETWEEN
ABCD
1NumberStepResult
21234.5675059
3175
4-4.712
51449
62.53
75012
Result in D2: 59

Frequently asked questions

How do I stop RANDBETWEEN from changing in Google Sheets?
Copy the cell and use Paste special, Values only, which replaces the formula with its current number. The calculation setting under File, Settings only changes how often the volatile result refreshes.

Google Sheets is used here only as a descriptive product name. FormulaCamp is not affiliated with Google.