You can use the RANDBETWEEN function to generate random integers (whole numbers only) between a range of values in an Excel worksheet. To specify the range, you use the function's arguments.
Whereas the more commonly used RAND function will return a decimal value between 0 and 1, RANDBETWEEN can generate an integer between any two defined values such as 0 and 10 or 1 and 100.
If you need to generate random numbers, including decimal values, use Excel's RAND function.
These instructions apply to Excel 2019, 2016, 2013, 2010, Excel Online and Excel for Office 365.
RANDBETWEEN Function Syntax and Arguments
A function's syntax is the layout of the function and includes the function's name, brackets, comma separators, and arguments.
The syntax for the RANDBETWEEN function is:
=RANDBETWEEN(Bottom,Top)
 Bottom (required) is the lowest possible integer the function can return as a result. You can enter the actual integer for this argument or use a cell reference to the location of the data in the worksheet.
 Top (required) is the highest possible integer the function can return as a result. You can enter the actual integer for this argument or use a cell reference.
If the Bottom argument is bigger than the Top argument, the RANDBETWEEN function will return a #NUM! error value.
Like the RAND function, RANDBETWEEN is one of Excel's volatile functions, which means:
 Every time someone makes a change to the worksheet, the function recalculates, producing a new random number.
 Any formula that depends — either directly or indirectly — on a cell containing a volatile function will also recalculate every time someone makes a change.
 You should use caution when using volatile functions in worksheets or workbooks containing large amounts of data, as they can slow down the program's response time due to the frequency of recalculations.
Using Excel's RANDBETWEEN Function
The example below shows how to get the RANDBETWEEN function to return a random integer between 1 and 100.
Options for entering the function and its arguments include:
 Typing the complete function into a worksheet cell
 Selecting the function and arguments using the Function Dialog Box
Many users find it easier to use the Function Dialog Box as it takes care of entering the function's syntax including brackets and comma separators between arguments.

Input the data in cells A2 and B2 as shown in the above image (1 and 100 respectively).

Click on cell C3 to make it the active cell which is where the RANDBETWEEN function goes.

Click on the Formulas tab of the ribbon.

Click on the Math & Trig icon to open the Function dropdown list.

Click on RANDBETWEEN in the list to open the Function Dialog Box. The data that you input into the blank rows in the dialog box will form the function's arguments.

Click Bottom in the dialog box.

Click cell A2 in the worksheet to enter this cell reference into the dialog box.

Click Top of the dialog box.

Click cell B2 in the worksheet to enter the second cell reference.

Click OK to complete the function and return to the worksheet.

A random number between 1 and 100 should appear in cell C3.

To generate another random number, press the F9 key on the keyboard which causes the worksheet to recalculate.

When you click on cell C3, the complete function, =RANDBETWEEN(A2,B2), appears in the formula bar above the worksheet.