Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, and 2016. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Random Numbers in a Range.
by Allen Wyatt
(last updated August 18, 2020)
Excel provides a power function that allows you to easily return a random integer number within a range. For instance, you can use the RANDBETWEEN function to return a random integer number between 50 and 99, or between –25 and 0. The syntax for the function is as follows:
All you need to do is provide the lower and upper values. If the first number you provide is actually higher than the second number, then RANDBETWEEN returns a #NUM! error.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (12364) applies to Microsoft Excel 2007, 2010, 2013, and 2016. You can find a version of this tip for the older menu interface of Excel here: Random Numbers in a Range.
Professional Development Guidance! Four world-class developers offer start-to-finish guidance for building powerful, robust, and secure applications with Excel. The authors show how to consistently make the right design decisions and make the most of Excel's powerful features. Check out Professional Excel Development today!
The INT function allows you to convert a value to an integer. The effect the function has depends on the characteristics ...Discover More
Finding a square root is easy because Excel provides a worksheet function for that purpose. Finding a different root may ...Discover More
Indirect references can be very helpful in formulas, but getting your head around how they work can sometimes be ...Discover More
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.