totn Excel Functions

MS Excel: How to use the RANDBETWEEN Function (WS)

This Excel tutorial explains 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.

The RANDBETWEEN function is a built-in function in Excel that is categorized as a Math/Trig Function. It can be used as a worksheet function (WS) in Excel. As a worksheet function, the RANDBETWEEN function can be entered as part of a formula in a cell of a worksheet.

Syntax

The syntax for the RANDBETWEEN function in Microsoft Excel is:

RANDBETWEEN( bottom, top )

Parameters or Arguments

bottom
The smallest integer value that the function will return.
top
The largest integer value that the function will return.

Returns

The RANDBETWEEN function returns a numeric value.
If bottom is a greater than top, the RANDBETWEEN function will return #NUM! error.

Applies To

  • Excel for Office 365, Excel 2019, Excel 2016, Excel 2013, Excel 2011 for Mac, Excel 2010, Excel 2007

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:

Microsoft Excel

Based on the Excel spreadsheet above, the following 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)