Loading
ExcelTips (Menu Interface)

# Random Numbers in a Range

Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Random Numbers in a Range.

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:

```=RANDBETWEEN(lower, upper)
```

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.

The RANDBETWEEN function is a part of the Analysis Toolpak. If you get an error when you try to use the function, you can make sure the toolpak is loaded in this manner:

1. Choose Add-Ins from the Tools menu. Excel displays the Add-Ins dialog box. (See Figure 1.)
2. Figure 1. The Add-Ins dialog box.

3. Make sure the Analysis Toolpak check box is selected.
4. Click on OK.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2812) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Random Numbers in a Range.

Related Tips:

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

### Leave your own comment:

 *Name: Email: Notify me about new comments ONLY FOR THIS TIP Notify me about new comments ANYWHERE ON THIS SITE Hide my email address *Text: *What is 5+3 (To prevent automated submissions and spam.)

### Comments for this tip:

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)

# Our Company

Sharon Parq Associates, Inc.

About Tips.Net

Contact Us

Advertise with Us

Our Privacy Policy

# Our Sites

Tips.Net

Beauty and Style

Cars

Cleaning

Cooking

DriveTips (Google Drive)

ExcelTips (Excel 97–2003)

ExcelTips (Excel 2007–2016)

Gardening

Health

Home Improvement

Money and Finances

Organizing

Pests and Bugs

Pets and Animals

WindowsTips (Microsoft Windows)

WordTips (Word 97–2003)

WordTips (Word 2007–2016)

# Our Products

Helpful E-books

Newsletter Archives

Excel Products

Word Products

# Our Authors

Author Index

Write for Tips.Net

Copyright © 2017 Sharon Parq Associates, Inc.