RANDBETWEEN function
Returns a random whole number between two values you specify, inclusive.
Available in Excel 2007 and later (earlier with the Analysis ToolPak), Excel for the web, Excel for Mac
Excel 2007 and laterWorks in Google Sheets
Syntax
RANDBETWEEN(bottom, top)| Argument | What it means | |
|---|---|---|
bottom | Required | The smallest whole number that can be returned. |
top | Required | The largest whole number that can be returned. |
Returns: A random integer from bottom to top (both included).
How RANDBETWEEN works
RANDBETWEEN picks a random whole number in a range, with both ends included: =RANDBETWEEN(1, 6) behaves like a die. It is the quickest way to create realistic test data (quantities, prices, scores), pick a random row for an audit, draw a winner or generate random dates, since dates are whole numbers in Excel.
The function is volatile, so every edit in the workbook or a press of F9 produces new numbers. Copy and Paste Special > Values when you want to keep them. Each cell is independent, so duplicates are possible; for a unique random order use SORTBY with RANDARRAY, or a RAND helper column and a sort.
Examples
1Roll a die
| A | |
|---|---|
| 1 | 4 |
Result: 4
Any whole number from 1 to 6 with equal probability. Because the function recalculates whenever the sheet changes, your result will differ; the value shown is only an illustration.
2Test data for daily sales
| A | B | |
|---|---|---|
| 1 | ||
| 2 | 1,377 |
Result: 1,377
Fill down to create a column of random sales between 500 and 2,000 for practising formulas and charts (number format #,##0). Because the function recalculates whenever the sheet changes, your result will differ; the value shown is only an illustration.
3Random date in 2026
| A | B | C | |
|---|---|---|---|
| 1 | |||
| 2 | 2026-08-14 |
Result: 2026-08-14
Dates are serial numbers (46023 to 46387), so RANDBETWEEN returns one of them; format the cell as a date. Because the function recalculates whenever the sheet changes, your result will differ; the value shown is only an illustration.
4Draw a prize winner
| A | B | C | |
|---|---|---|---|
| 1 | Employee | ||
| 2 | Ana | Ben | |
| 3 | Ben | ||
| 4 | Chloe | ||
| 5 | Dev | ||
| 6 | Ema |
Result: Ben
ROWS counts the 5 entries, RANDBETWEEN picks a position and INDEX returns the name. Because the function recalculates whenever the sheet changes, your result will differ; the value shown is only an illustration.
Common errors and how to fix them
| Error | Why it happens | Fix |
|---|---|---|
#NUM! | bottom is greater than top. | Swap the arguments. |
#VALUE! | An argument is text. | Use numbers or dates. |
Tips
- Random decimals with 2 places:
=RANDBETWEEN(1000, 5000)/100gives 10.00–50.00. - Use Paste Values after drawing a winner so the result is documented.
Questions
How do I get random numbers without duplicates?
In Microsoft 365: =TAKE(SORTBY(SEQUENCE(49), RANDARRAY(49)), 6) draws 6 different numbers from 1–49. In older versions, add a RAND helper column and use RANK.EQ.
Why do my random numbers change when I type elsewhere?
RANDBETWEEN is volatile and recalculates on every change. Paste the results as values to freeze them.
Google Sheets
RANDBETWEEN also exists in Google Sheets and works the same way for everyday use, so the examples above work there too.
RANDBETWEEN in other languages
In a non-English version of Excel the function has a local name. Excel translates formulas automatically when a file is opened in another language.
| Language | Function name |
|---|---|
| Danish | SLUMPMELLEM |
| Dutch | ASELECTTUSSEN |
| Finnish | SATUNNAISLUKU.VÄLILTÄ |
| French | ALEA.ENTRE.BORNES |
| German | ZUFALLSBEREICH |
| Hungarian | VÉLETLEN.KÖZÖTT |
| Italian | CASUALE.TRA |
| Norwegian (Bokmål) | TILFELDIGMELLOM |
| Polish | LOS.ZAKR |
| Portuguese (Brazil) | ALEATÓRIOENTRE |
| Portuguese (Portugal) | ALEATÓRIOENTRE |
| Russian | СЛУЧМЕЖДУ |
| Spanish | ALEATORIO.ENTRE |
| Swedish | SLUMP.MELLAN |
| Turkish | RASTGELEARADA |