This Excel tutorial explains how to use the Excel RANDBETWEEN function with syntax and examples.
top is the largest integer value that the RANDBETWEEN function will return.

Based on the spreadsheet above, the following Excel RANDBETWEEN examples would return:
Description
The Microsoft Excel RANDBETWEEN function returns a random number that is between a bottom and top range. The RANDBETWEEN function returns a new random number each time your spreadsheet recalculates.Syntax
The syntax for the Microsoft Excel RANDBETWEEN function is:RANDBETWEEN( bottom, top )
Parameters or Arguments
bottom is the smallest integer value that the RANDBETWEEN function will return.top is the largest integer value that the RANDBETWEEN function will return.
Note
- If bottom is a greater than top, the RANDBETWEEN function will return #NUM! error.
Applies To
The RANDBETWEEN function can be used in the following versions of Microsoft Excel:- Excel 2013, Excel 2011 for Mac, Excel 2010, Excel 2007
Type of Excel Function
The RANDBETWEEN function can be used in Microsoft Excel as the following type of function:- Worksheet function (WS)
Example (as Worksheet Function)
Let's look at some Excel RANDBETWEEN function examples and explore how to use the RANDBETWEEN function as a worksheet function in Microsoft Excel:
Based on the spreadsheet above, the following Excel RANDBETWEEN examples would return:
=RANDBETWEEN(A1,A2) Result: random number (between 1 and 5) =RANDBETWEEN(1,5) Result: random number (between 1 and 5) =RANDBETWEEN(B1,B2) Result: random number (between 10 and 20) =RANDBETWEEN(100,200) Result: random number (between 100 and 200) =RANDBETWEEN(200,100) Result: #NUM! (because bottom is greater than top)