tech on the net

MS Excel: RANDBETWEEN Function (WS)

Learn how to use the Excel RANDBETWEEN function with syntax and examples.

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 you would use the RANDBETWEEN function as a worksheet function in Microsoft Excel:

Microsoft Excel

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

=RANDBETWEEN(A1,A2) would return a random number
(between 1 and 5)
=RANDBETWEEN(1,5) would return a random number
(between 1 and 5)
=RANDBETWEEN(B1,B2) would return a random number
(between 10 and 20)
=RANDBETWEEN(100,200) would return a random number
(between 100 and 200)
=RANDBETWEEN(200,100) would return #NUM!
because bottom is greater than top