# 5 Ways to Generate Random Number Between 0 and 1 in Excel

In this lesson, Iโll demonstrate 5 Ways to generate random number between 0 and 1 in Excel. Moreover, these techniques will enable you to solve the problem that led you here. However, you will master several crucial Excel features and functions during this article which will come in extremely handy for any assignment using Excel.

The sample worksheet that was used during the discussion is available for download below.

## Concept Behind Generating Random Number in Excel

Excelโs random number generator, like all the other computer systems, generates quasi or pseudo-random numbers using mathematical algorithms. This implies that Excel-generated random numbers are, in principle, foreseeable. The RAND and RANDBETWEEN functions in Excel generate pseudo-random integers based on the Uniform distribution. This distribution is also commonly referred to as the rectangle distribution. This is a sort of distribution in which there is a chance that a random variable will take any one of the many potential values at any given time. For example, if we toss a single die each of the six potential toss results (1, 2, 3, 4, 5, 6) is equally probable.

## Learn to Generate Random Number Between 0 and 1 in Excel with These 5 Easy Solutions

Here, in this article, we will learn how to generate random number between 0 and 1 in Excel using different approaches. To be exact, Iโve provided a total of 5 methods down below.

Method 1

### 1. Using RAND Function to Generate Random Number Between 0 and 1

Here, we are going to demonstrate generating random number between 0 and 1 using the RAND function. This function by default generates a random number greater than or equal to 0 and less than 1 if not added anything. Follow the instructions below.

โฌ๏ธโฌ๏ธ STEPS โฌ๏ธโฌ๏ธ

• First, select a cell and copy the following formula.

=RAND()

• Now press Enter to get the random number.

๐ Read More: Generating Random Number Between Two Numbers in Excel

Method 2

### 2. Using RANDBETWEEN Function

Here, we are going to use the RANDBETWEEN function to generate random number between 0 and 1. This function generates only whole numbers, no float numbers so we are going to add some logic to it.ย  Follow the instructions below.

โฌ๏ธโฌ๏ธ STEPS โฌ๏ธโฌ๏ธ

• First, copy down the following formula in a cell.

=RANDBETWEEN(0,1000)/1000

• Now press Enter to get the random number.

๐ Read More: 7 Ways to Create Random 5 Digit Number Generator in Excel

Method 3

### 3. Create Random Array Containing Number Between 0 and 1 in Excel

In this part, we are using the RANDARRAY function which generates random numbers.

You may set the minimum and maximum values, and the number of rows and columns as well as receive whole numbers or decimal values as per your demand. Here, the syntax is:

RANDARRAY(Row_numb, Column_numb, Bottom_value, Top_value, Decimal/Integer)

โฌ๏ธโฌ๏ธ STEPS โฌ๏ธโฌ๏ธ

• First, copy the following formula in a cell.

=RANDARRAY( 15,1,0, 1,FALSE)

• Press Enter to get the results.

๐ Read More: 4 Ways to Introduce Random Number in Excel with Decimals

Method 4

### 4. Randomly Select Specific Numbers Between 0 and 1

In this section, we are going to use two different functions to create a formula for generating random number between 0 and 1 from some specific numbers. We are going to use CHOOSE and RANDBETWEEN functions. The CHOOSE function retrieves a value from an array at a specific location or index and the RANDBETWEEN function generates random integer numbers. Follow the instructions below.

โฌ๏ธโฌ๏ธ STEPS โฌ๏ธโฌ๏ธ

• First, copy down the following formula in a cell.

=CHOOSE(RANDBETWEEN(1,7),0.37,0.16,0.82,0.59,0.45,0.73,0.81)

๐จ ย  Formula Breakdown

๐ย  RANDBETWEEN(1,7)

The RANDBETWEEN function here returns a random value from 1 to 7.

๐ย  CHOOSE(RANDBETWEEN(1,7),0.37,0.16,0.82,0.59,0.45,0.73,0.81)

The CHOOSE function returns the nth value from its given array. The n here is the value that this part RANDBETWEEN(1,7) returns.

• Press Enter to get the random number.

๐ Read More: 8 Ways to Make Random 4 Digit Number Generator in Excel

Method 5

### 5. Using VBA Code

Here, we are going to use Microsoftโs VBA feature to generate random numbers between 0 and 1. We will be developing a code that will return us our desired random values. Follow the instructions below.

โฌ๏ธโฌ๏ธ STEPS โฌ๏ธโฌ๏ธ

• After that, a new window will pop up. Select Module from the Insert tab.

• Now copy the following code.
``````Sub Generating_random_number_VBA()
Dim a As Long
a = 10
For a = 1 To a
ย ย ย ย ย ย ย ย ย ย ย  ActiveCell.Value = Rnd()
ย ย ย ย ย ย ย ย ย ย ย  ActiveCell.Offset(1, 0).Select
Next a
End Sub``````

• Save the code as macro enabled workbook.
• After that, select the top cell of the table.

• Now Go to Visual Basic from the Developer tab.

• Click The Run button.

• Or you can also go to Macros from the Developer.

• After that, click Run.

• The result will be like this.

๐ Read More: 6 Ways to Generate Random 10-Digit Number in Excel

## ๐ Important Notes

`๐๏ธ`ย  You can use F9 to transform the formula into a value.

`๐๏ธ`ย  Use shortcuts to reduce the time for instance F4 for absolute value.

`๐๏ธ`ย  While writing formulas carefully see the suggestions and donโt forget the commas and parentheses.

`๐๏ธ`ย  Be careful while defining criteria to be accurate as the dataset.

`๐๏ธ`ย  As this is an xlsm file which means itโs a macro-enabled file. If you download this make sure to unblock it by going to the file properties and unticking Block before using.

`๐๏ธ`ย  For unique random numbers create more than you need then use the Duplicate Remover for Excel to cut the duplicates out.

`๐`ย  The article demonstrated different functions to generate random numbers between 0 and 1 in Excel.

`๐`ย  In the first section, we showed how to use the RAND function in excel.

`๐`ย  Then, we demonstrated different cases like specifying some numbers and randomly choosing them, We used RANDBETWEEN, RANDARRAY, and CHOOSE functions to generate random values between 0 and 1 in Excel.

`๐`ย  We also created an array of random numbers that range from 0 to 1.

`๐`ย  Finally, we used a VBA code to demonstrate the advanced solution.