The RANDBETWEEN function returns a random integer number between the numbers specified. In this guide, we’re going to show you how to use this function and also go over some tips and error handling methods.


Supported versions

  • All Excel versions

Syntax

RANDBETWEEN(bottom, top)


Arguments

bottom

An integer representing the smallest value the function will return.

top

An integer representing the largest value the function will return.



Example

Note that we are using named ranges in formulas to make them easier to read. This is not required.

=RANDBETWEEN(bottom,top)
formula returns an integer that is between the values of the named ranges bottom and top. The result will change when you run the workbook calculations again. Select the cell, and press F9 to update the outcome.

Download Workbook


Tips

  • The RANDBETWEEN function is a volatile function that returns a new random integer after every workbook calculation. Press F9 to update the value.
  • Use the RAND function to return a random real number between 0 and 1.
  • To generate a set of random numbers, select the cells, enter the =RANDBETWEEN(bottom,top) formula and press Ctrl + Enter (⌃ + Return in Mac).
  • Microsoft has announced that they’re soon going to release the RANDARRAY function to Office 365 subscribers. This new dynamic array function allows creating an array of randomly generated numbers.