RAND & RANDBETWEEN Random Number Formulas
RAND & RANDBETWEEN Random Number Formulas

RAND & RANDBETWEEN Random Number Formulas

Generate unbiased test datasets, audit sample selections, and Monte Carlo numbers using Excel RAND and RANDBETWEEN. Learn how to freeze volatile values cleanly.

M. Ichsanul Fadhil
Published

RAND & RANDBETWEEN Generator Formulas

Whether you are creating synthetic data for software testing, picking random invoice samples for financial fraud audits, or running Monte Carlo risk simulations, you need unbiased random numbers.

Excel provides two built-in random generators: RAND and RANDBETWEEN. However, both functions come with a critical trait: they are volatile functions. Every time you press Enter, sort data, or open the workbook, Excel recalculates and changes all your random values!

This guide explains how to generate random decimals and integers, scale random numbers into custom ranges, and freeze generated values permanently so your audit samples stay consistent.

RAND()

Decimals Between 0 and 1

Generates an evenly distributed continuous decimal number greater than or equal to 0 and less than 1. Takes no arguments.

RANDBETWEEN(bottom, top)

Whole Integers in Range

Returns an evenly distributed random whole integer between the bottom and top bounds (inclusive). Perfect for lottery draws and IDs.

Quick Comparison: RAND vs RANDBETWEEN

Formula Output Type Default Range Required Arguments Best Application
RAND() Continuous Decimal 0.000000 to 0.999999 None (empty parentheses) Probabilities, Monte Carlo models, random sorting
RANDBETWEEN(min, max) Discrete Integer User specified (inclusive) 2 (bottom and top limits) Random audit sampling, invoice selection, simulation roll

Warning: Because random functions recalculate on every worksheet change, never leave active RAND formulas in an audit spreadsheet you send to clients or regulators. Always copy and paste as static values once your sample is picked.

How the Random Engines Work

1. The Syntax of RAND()

The RAND formula requires empty parentheses:

=RAND()    ' e.g. Returns 0.684219

To scale a random decimal to a custom range (such as between 50 and 150):

=Min + RAND() * (Max - Min)
=50 + RAND() * (150 - 50)

2. The Syntax of RANDBETWEEN()

Specify the inclusive lower and upper whole numbers:

=RANDBETWEEN(bottom, top)
=RANDBETWEEN(1000, 9999)    ' Returns 4-digit ID

Note: If bottom is greater than top, Excel returns a #NUM! error.

3. The Freeze Protocol (Preserving Your Sample)

To lock your random sample permanently:

  1. Select the cells containing the formulas.
  2. Press Ctrl + C to copy.
  3. Press Ctrl + Shift + V (or Right-Click -> Paste Special -> Values).

Now the random numbers become fixed static values that will never change again.

Real-Life Workplace Scenarios

1. Independent Compliance Audit Selection

Compliance teams draw 50 random transaction IDs from a pool of 10,000 ledger rows using RANDBETWEEN(1, 10000) to guarantee objective, unmanipulated sample selection.

2. Randomizing List Order (Shuffling)

To shuffle a roster of candidates or survey participants, insert a helper column with =RAND() and sort the table from smallest to largest.

Common Mistakes to Avoid

  • Typing Values in Parentheses for RAND: Writing =RAND(100) produces an error. RAND takes no arguments.
  • Reversed Bounds in RANDBETWEEN: Writing =RANDBETWEEN(50, 10) triggers a #NUM! error because the bottom bound exceeds the top.

Generate audit test data in our spreadsheet playground below.

Automated Commercial Sales Invoice
Sales & Billing
Applied Project Exercise

Ready to apply RAND & RANDBETWEEN Random Number Formulas in a real workbook?

See how math formulas automate row totals, tiered discounts, and tax computations.

Open Automated Commercial Sales Invoice
Tactical Arena
Loading Spreadsheet Playground...Initializing calculation engine

Share This Lesson

Spread the word with your peers and challenge your friends

Discussion
0 Comments
No comments yet. Be the first to share your thoughts!