Exceljet

Quick, clean, and to the point

Random number between two numbers

Excel formula: Random number between two numbers
Generic formula 
=RANDBETWEEN(lower,upper)
Summary 

To generate a random number between two numbers, you can use the RANDBETWEEN function. In the example shown, the formula in B5 is:

=RANDBETWEEN(1,100)
Explanation 

The Excel RANDBETWEEN function returns a random integer between given numbers. RANDBETWEEN is a volatile function recalculates when a worksheet is opened or changed.

In the example shown, the formula in B5 is:

=RANDBETWEEN(1,100)

This formula is then copied down from B5 to B11. The result is random numbers between 1-100.

Note that the RANDBETWEEN function will generate new numbers whenever a change is triggered on the worksheet. That includes any edits to the worksheet, also also simply opening the workbook.

To prevent random numbers from being recalculated again, you can replace the formulas with the values last calculated:

  1. Copy the formulas
  2. Use Paste Special > Values

Notes

  1. The RAND function can generate random decimal values.
  2. The RANDARRAY function (new in Excel 365) can generate random numeric arrays. 
Author 
Dave Bruns

Excel Formula Training

Formulas are the key to getting things done in Excel. In this accelerated training, you'll learn how to use formulas to manipulate text, work with dates and times, lookup values with VLOOKUP and INDEX & MATCH, count and sum with criteria, dynamically rank values, and create dynamic ranges. You'll also learn how to troubleshoot, trace errors, and fix problems. Instant access. See details here.

Download 200+ Excel Shortcuts

Get over 200 Excel shortcuts for Windows and Mac in one handy PDF.