Excel RANDBETWEEN Function
The RANDBETWEEN function is used to generate random numbers in Excel. And it continues to do so every time a recalculation occurs on the same worksheet. This means that a new random number is generated after every recalculation.
= RANDBETWEEN (bottom, top)
The arguments below can be found in the Excel RANDBETWEEN function.
bottom – this is the integer which represents the smallest random integer that will be returned by the RANDBETWEEN function. It is the lowest value in the range.
top – this, on the other hand, is the higher value in the range. It represents the largest random integer that will be returned by the function.
The RANDBETWEEN function returns an integer between the top and bottom values. This means that if, for instance, we have a range of 10 and 20, the function will generate any number between these two values.
We take a look at the scenario of generating the different values between two years, “Year 1” and “Year 2” using the RANDBETWEEN function.
Figure 1. Excel shows the bottom and top integers for each year range.
Enter the syntax for the RANDBETWEEN function in excel, which in this case is, “=RANDBETWEEN(A3, B3)”. The syntax returns the first random number between 20 and 30.
Figure 2. The Excel RANDBETWEEN function returns a random number.
Do a drag down of the “Result” cell. This action returns all the random numbers of each cell.
Figure 3. The Excel RANDBETWEEN function returns all random numbers.
Remember we said that the RANDBETWEEN function returns a different random integer every time a calculation is done.
In this regard, you can create a new column, “Result 2”, to test this out.
Figure 4. A new column for testing the RANDBETWEEN function.
Enter the same formula in any of the cells. As you would see, the function returns a completely different integer for each column.
Figure 5. The Excel RANDBETWEEN function returns a completely different set of integers.
Excel RANDBETWEEN Function Notes
- A click of an existing RANDBWETWEEN formularized cell in Excel changes the numbers in it every time.
- If you’d like to let a certain cell remain constant, simply press the F9 button after using the RANDBETWEEN function in the cell.