Start Free Trial
← Back to Blog

A Guide to Generating Random Numbers in Excel

Random numbers are essential in various scenarios, from simulations and data analysis to creating randomized lists and performing statistical tests. Excel provides two primary functions for generating random numbers: RAND and RANDBETWEEN. This article will explain how to use these functions effectively, including their syntax, examples, and use cases.

The RAND Function

The RAND function generates a random decimal number between 0 and 1. It is useful for creating random numbers when you need a continuous range of values.

Syntax:

=RAND()

Example 1: Basic Usage

To generate a random decimal number:

  1. Enter =RAND() in a cell.
  2. Press Enter.

You might get a result like 0.5489. Each time the worksheet recalculates, RAND will generate a new random number.

Example 2: Scaling to a Range

If you want to generate random decimal numbers within a specific range, you can scale the result of RAND:

=10 + (20 - 10) * RAND()

The RANDBETWEEN Function

The RANDBETWEEN function generates a random integer between two specified values. It’s ideal for scenarios where you need whole numbers within a specific range.

Syntax:

=RANDBETWEEN(bottom,top)

Example 1: Basic Usage

To generate a random integer between 1 and 100:

  1. Enter =RANDBETWEEN(1,100) in a cell.
  2. Press Enter.

You might get a result like 42. Each time the worksheet recalculates, RANDBETWEEN will generate a new random integer within the specified range.

Example 2: Generating Random Dates

To generate a random date between January 1, 2023, and December 31, 2023, you need to convert dates to serial numbers:

=RANDBETWEEN(DATE(2023,1,1),DATE(2023,12,31))

Practical Uses of Random Number Generation

Refreshing Random Numbers

Both RAND and RANDBETWEEN functions recalculate every time the worksheet is updated or recalculated. To stop this and fix the current values:

  1. Copy the cells with the random numbers.
  2. Right-click the selected cells and choose Paste Special.
  3. Select Values and click OK.

This action replaces the formulas with their current values, preventing them from changing.

Limitations and Considerations

Excel’s RAND and RANDBETWEEN functions are versatile tools for generating random numbers, useful in various applications from data analysis to simulations. Understanding how to use these functions allows you to effectively incorporate randomness into your spreadsheets and perform tasks that require randomization.

📁 Get All Templates Free →

Opens in Google Drive — view and download for free

Ready to try Updoot free?

GPS time tracking, scheduling, HR, payroll, CRM, and more in one platform built for small business.

Start Free Today