How to Generate Random Numbers in Excel (A Step-by-Step Guide) (2024)

  • How to Generate Random Numbers in Excel (A Step-by-Step Guide) (1) Sumit Bansal

FREE EXCEL TIPS EBOOK - Click here to get your copy

There may be cases when you need to generate random numbers in Excel.

For example, to select random winners from a list or to get a random list of numbers for data analysis or to create random groupsof students in class.

In this tutorial, you will learn how to generate random numbers in Excel (with and without repetitions).

Generate Random Numbers in Excel

There are two worksheet functions that are meant to generate random numbers in Excel: RAND and RANDBETWEEN.

  • RANDBETWEEN function would give you the random numbers, but there is a high possibility of repeats in the result.
  • RAND function is more likely to give you a result without repetitions. However, it only gives random numbers between 0 and 1. It can be used with RANK to generate unique random numbers in Excel (as shown later in this tutorial).

Generate Random Numbersusing RANDBETWEEN function in Excel

Excel RANDBETWEEN function generates a set of integer random numbers between the two specified numbers.

RANDBETWEEN function takes two arguments – the Bottom value and the top value. It will give you an integer number between the two specified numbers only.

For example, suppose I want to generate 10 random numbers between 1 and 100.

Here are the steps to generate random numbers using RANDBETWEEN:

  • Select the cell in which you want to get the random numbers.
  • In the active cell, enter =RANDBETWEEN(1,100).
  • Hold the Control key and Press Enter.

This will instantly give me 10 random numbers in the selected cells.

How to Generate Random Numbers in Excel (A Step-by-Step Guide) (2)

While RANDBETWEEN makes it easy to get integers between the specified numbers, there is ahigh chance of repetition in the result.

For example, when I use the RANDBETWEEN function to get 10 random numbers and use the formula =RANDBETWEEN(1,10), it gives me a couple of duplicates.

How to Generate Random Numbers in Excel (A Step-by-Step Guide) (3)

If you’re OK with duplicates, RANDBETWEEN is the easiest way to generate random numbers in Excel.

Note that RANDBETWEEN is a volatile function and recalculates every time there is a change in the worksheet. To avoid getting the random numbers recalculate, again and again, convert the result of the formula to values.

Generate Unique Random Numbersusing RAND and RANK function in Excel

I tested the RAND function multiple times and didn’t find duplicate values. But as a caution, I recommend you check for duplicate values when you use this function.

Suppose I want to generate 10 random numbers in Excel (without repeats).

Here are the steps to generate random numbers in Excel without repetition:

  • Select the cells in which you want to get the random numbers.
  • In the active cell, enter =RAND()
  • Hold the Control key and Press Enter.How to Generate Random Numbers in Excel (A Step-by-Step Guide) (4)
  • Select all the cell (where you have the result of the RAND function) and convert it to values.
  • In the adjacent column, use the following formula:=RANK.EQ(A2,$A$2:$A$11)How to Generate Random Numbers in Excel (A Step-by-Step Guide) (5)

Now you can use the values in column B as the random numbers.

Note: RAND is a volatile formula and would recalculate every time there is any change in the worksheet. Make sure you have converted all the RAND function results to values.

Caution: While I checked and didn’t find repetitions in the result of the RAND function, I still recommend you check once you have generated these numbers. You can use Conditional Formatting to highlight duplicates or use the Remove Duplicate option to get rid of it.

You May Also Like the Following Excel Tutorials:

  • Automatically Sort Data in Alphabetical Order using Formula.
  • Random Group Generator Template
  • How to Shuffle a List of Items/Names in Excel?
  • How to Do Factorial (!) in Excel (FACT function)

How to Generate Random Numbers in Excel (A Step-by-Step Guide) (6)

FREE EXCEL BOOK

Get 51 Excel Tips Ebook to skyrocket your productivity and get work done faster

How to Generate Random Numbers in Excel (A Step-by-Step Guide) (7)

Hello there! I'm Sumit Bansal, founder of trumpexcel.com and an Excel MVP. I started this website in 2013 with a simple goal: to share my love for Excel through easy to follow tips, tutorials and videos. I'm here to help you get the best out of MS Excel to save time and boost your productivity.

3 thoughts on “How to Generate Random Numbers in Excel”

  1. Just a trick, RAND and RANDBETWEEN are volatile functions, so each time there’s a change they will be updated. To avoid this, you can create a Pivot Table referencing the cells with the random values (functions) and then reference the Pivot Table values. This way the random values won’t change until the Pivot Table is updated.

    Reply

    • qawq

      Reply

Leave a Comment

BEST EXCEL TUTORIALS

Best Excel Shortcuts

Conditional Formatting

Excel Skills

Creating a Pivot Table

Excel Tables

INDEX- MATCH Combo

Creating a Drop Down List

Recording a Macro

VBA Loops

How to Generate Random Numbers in Excel (A Step-by-Step Guide) (2024)

FAQs

How to Generate Random Numbers in Excel (A Step-by-Step Guide)? ›

If you want to use RAND to generate a random number but don't want the numbers to change every time the cell is calculated, you can enter =RAND() in the formula bar, and then press F9 to change the formula to a random number. The formula will calculate and leave you with just a value.

How to use Excel to generate random numbers? ›

If you want to use RAND to generate a random number but don't want the numbers to change every time the cell is calculated, you can enter =RAND() in the formula bar, and then press F9 to change the formula to a random number. The formula will calculate and leave you with just a value.

How do I generate a random number between 1 to 100 in Excel? ›

You simply use the RANDBETWEEN function. It asks for the bottom number (in this case it will be 1) and the top number (100). You can do this for just 1 cell or a range of cells. Remember, it will give you a new number every time you either enter data or a new function.

How do you generate a random number from 1 to 10 in Excel? ›

Click on the cell where you'd like to generate your random number. Enter the formula =RANDBETWEEN([LowerLimit],[UpperLimit]). For example, if you'd like to generate a random number between one and 10, you may enter =RANDBETWEEN(1,10). Press the "Enter" key.

How do I generate a random number order in Excel? ›

You'll start by creating a Random column to the right of the names. Now that you have a new column for your random numbers, it's time to use the RAND function to generate those numbers! To use the RAND function, simply enter =RAND() into the first cell of your new Random column.

How to generate random numbers? ›

Hardware based random-number generators can involve the use of a dice, a coin for flipping, or many other devices. A pseudo-random number generator is an algorithm for generating a sequence of numbers whose properties approximate the properties of sequences of random numbers.

How do I generate a random number between 1 and 1000 in Excel? ›

The RANDBETWEEN function — = RANDBETWEEN ( bottom, top ) — generates a series of random numbers within a specified range of a higher and lower number. The function produces random integers between your given values. It's key to note that this function could also return the upper and lower numerals you set as values.

How to auto generate data in Excel? ›

Fill data automatically in worksheet cells
  1. Select one or more cells you want to use as a basis for filling additional cells. For a series like 1, 2, 3, 4, 5..., type 1 and 2 in the first two cells. ...
  2. Drag the fill handle .
  3. If needed, click Auto Fill Options. and choose the option you want.

How to generate random numbers in sheet? ›

For example, if you use the formula =RAND(), it will produce a different random decimal number each time it recalculates. The generated number could be 0.123456, 0.789012, or any other value between 0 and 1.

How do I randomly select 10 values in Excel? ›

Create a list of values in a column or row in Excel. For example, let's assume the list is in cells A1 to A10. In an empty cell, use the following formula to generate a random row number: =RANDBETWEEN(1,10). Then, modify the range (1,10) based on the number of values in your list.

How to generate random numbers in Excel with mean and standard deviation? ›

Generate random numbers by given Mean and Standard Deviation

In the formula =NORMINV(RAND(),$B$1,$B$2), $B1 indicates the mean, $B$2 indicates the standard deviation. In the cell D1 and D2 you have to calculate the mean and standard deviation of the random number you have entered in step 2.

Can Excel generate a random sample? ›

In the first cell underneath your "random" column heading, input the random sample generation Excel formula:=RAND()The RAND() function in Excel can generate any random number between zero and one. This is useful for creating random samples because it helps reorder your data and select a sample size without bias.

How do you generate random text and number in Excel? ›

Generating text strings and passwords in Excel

The four functions return the following random values: RANDBETWEEN(0,9) - returns random numbers between 0 and 9. CHAR(RANDBETWEEN(65,90)) - returns random UPPERCASE letters between A and Z. CHAR(RANDBETWEEN(97, 122)) - returns random lowercase letters between a and z.

Top Articles
Latest Posts
Article information

Author: Dean Jakubowski Ret

Last Updated:

Views: 6382

Rating: 5 / 5 (70 voted)

Reviews: 85% of readers found this page helpful

Author information

Name: Dean Jakubowski Ret

Birthday: 1996-05-10

Address: Apt. 425 4346 Santiago Islands, Shariside, AK 38830-1874

Phone: +96313309894162

Job: Legacy Sales Designer

Hobby: Baseball, Wood carving, Candle making, Jigsaw puzzles, Lacemaking, Parkour, Drawing

Introduction: My name is Dean Jakubowski Ret, I am a enthusiastic, friendly, homely, handsome, zealous, brainy, elegant person who loves writing and wants to share my knowledge and understanding with you.