RANDBETWEEN Function in Excel: Random Whole Numbers for Test Data

RANDBETWEEN Function in Excel: Random Whole Numbers for Test Data featured illustration

πŸ“Ž This article includes 1 downloadable practice file ↓

⏱ 2 min readUpdated 12 October 2026

MathLevel: BeginnerAvailable in: Excel 2007+

In this article
  1. Syntax
  2. Examples
  3. Example 1
  4. Example 2
  5. RANDBETWEEN in practice
  6. Where you will use it
  7. Worked example
  8. Mistakes people make
  9. Related functions
  10. Continue learning

RANDBETWEEN returns a random integer between two numbers. It recalculates on every change β€” convert to values when you want it fixed.

Advertisement

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.

πŸ’‘ Copy β†’ Paste Special β†’ Values to freeze random numbers.

RANDBETWEEN in practice

Where you will use it

  • Generate test data quickly
  • Random dates between two dates
  • Pick a random winner number

Worked example

BottomTopFormulaResult
1100=RANDBETWEEN(A2,B2)(changes every recalculation)
10005000=RANDBETWEEN(A3,B3)(changes every recalculation)

Results calculated in Excel. New random numbers appear on every recalculation.

Mistakes people make

MistakeWhat to do instead
Values change on every editPaste as values to freeze
Duplicates when you need unique picksUse SORTBY(range, RANDARRAY(...)) and take the top N

RAND Β· RANDARRAY Β· INDEX

πŸ“š Part of the free Excel course: Beginner β†’ Expert Β· Try it in the Formula Lab or ask the AI Helper.

⚑ Interactive Practice Lab & Formula Tester:

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.

✨ Ask AI about this article

Stuck on a step? Ask a question and the AI answers using this article.

Free Β· AI can be wrong

Leave a Reply

Your email address will not be published. Required fields are marked *