How to use the Excel RANDBETWEEN function

The RANDBETWEEN Function is categorized under Excel Math and Trigonometry functions. The function will return a random integer number between the user-specified numbers. It will return a random integer number every time the worksheet is opened or calculated.

As a financial analyst, the RANDBETWEEN function can be used to generate random integer numbers within a specified range. However, it is used less frequently in the finance industry, as compared to other fields such as cryptography and statistics.

Syntax: RANDBETWEEN(bottom, top)

The RANDBETWEEN function syntax has the following arguments:

  • Bottom    Required. The smallest integer RANDBETWEEN will return.
  • Top    Required. The largest integer RANDBETWEEN will return.

Example: Let’s look at some Excel RANDBETWEEN function examples and explore how to use the RANDBETWEEN function as a worksheet function in Microsoft Excel:

Excel RANDBETWEEN function - How to use the Excel RANDBETWEEN function

Syntax:  =RANDBETWEEN(A2,B2)


RANDBETWEEN function - How to use the Excel RANDBETWEEN function

Based on the Excel spreadsheet above, the following RANDBETWEEN examples would return:

Result: 786

Result: 1642

Result: -15

Result: -45

Result: -1

Result: 6

Result: 2

Syntax: =RANDBETWEEN(A10,B10)
Result: -5

Syntax: =RANDBETWEEN(A11,B11)
Result: 0


  • Use the RANDBETWEEN function to get a random integer between bottom and top. For example, =RANDBETWEEN(1,50) might generate the number 28
  • RANDBETWEEN calculates a new value each time the worksheet is calculated. To stop random numbers from being updated, copy the cells that contain RANDBETWEEN to the clipboard, then use Paste Special > Values to convert to text.
  • To generate a set of random integers in multiple cells, select the cells, enter the RANDBETWEEN function, and press control+ enter.
  • To get a random number that doesn’t change when the worksheet is calculated, enter RANDBETWEEN in the formulas bar and then press F9 to convert the formula into its result.
  • Common Errors: +) #NUM! – Occurs if the supplied bottom argument is greater than the supplied top argument.
    +)  #VALUE! – Occurs if either of the supplied arguments are non-numeric.

Add a Comment

Your email address will not be published. Required fields are marked *