
π This article includes 1 downloadable practice file β
In this article
RANDBETWEEN returns a random integer between two numbers. It recalculates on every change β convert to values when you want it fixed.
Syntax
=RANDBETWEEN(bottom, top)
| Argument | What it means |
|---|---|
bottom, top |
Smallest and largest allowed value. |
Examples
Example 1
=RANDBETWEEN(1000, 50000)
Random sales amounts for practice data.
Example 2
=DATE(2024,1,1)+RANDBETWEEN(0,365)
Random dates in 2024.
RANDBETWEEN in practice
Where you will use it
- Generate test data quickly
- Random dates between two dates
- Pick a random winner number
Worked example
| Bottom | Top | Formula | Result |
|---|---|---|---|
| 1 | 100 | =RANDBETWEEN(A2,B2) | (changes every recalculation) |
| 1000 | 5000 | =RANDBETWEEN(A3,B3) | (changes every recalculation) |
Results calculated in Excel. New random numbers appear on every recalculation.
Mistakes people make
| Mistake | What to do instead |
|---|---|
| Values change on every edit | Paste as values to freeze |
| Duplicates when you need unique picks | Use SORTBY(range, RANDARRAY(...)) and take the top N |
Related functions
RAND Β· RANDARRAY Β· INDEX
π Part of the free Excel course: Beginner β Expert Β· Try it in the Formula Lab or ask the AI Helper.
Test formulas dynamically in our web formula laboratory or download the companion Excel workbook.
π Practice files for this article
- πPractice workbook: Math & rounding24 tasks on realistic sales data β type your formula, the Check column turns green when it is right. Answers sheet included.β¬ XLSX Β· 35 KB
Free to use for learning. Files with macros (.bas) are plain text β import them with Alt+F11 β File β Import File, and always test on a copy.
Atul (AJ) builds office-automation and local-first AI tools as Atulya AI, and works with Excel, SAP and Oracle EPM every day. He writes about the shortcuts, macros and automations that actually save time β plus the occasional wacky fact. Videos on YouTube: Lazy Automator AI (@LazyAutomatorAI).
More posts by Atul βBuild this skill next
This page is a quick function reference. Use it for syntax, then practise the function in a broader workflow.
Stuck on a step? Ask a question and the AI answers using this article.