Excel RAND and RANDBETWEEN: random numbers, picking a winner and test data
RAND returns a random number from 0 to 1, RANDBETWEEN one within a range. Prize draws, shuffling, test data and the main trap — recalculation.
A shop is running a promotion and needs to pick one winner among its customers. A teacher wants to give each group the test questions in a different order. An analyst needs 100 rows of “fake” sales to test formulas. All three need a random number.
RAND returns a random decimal between 0 and 1. RANDBETWEEN returns a random whole number between two numbers you choose: 1 to 100, 50,000 to 200,000.
Their key feature (and trap): they recalculate with any change on the sheet — the number is new every time.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Customer | Winner | ||
| 2 | Aziz | Malika | ||
| 3 | Dilnoza | |||
| 4 | Javohir | Random number | ||
| 5 | Malika | 0,7109 | ||
| 6 | Sardor | |||
| 7 | Nodira | |||
| 8 |
=ИНДЕКС(A2:A7;СЛУЧМЕЖДУ(1;6)) and C5 =СЛЧИС() — the results were frozen with Paste Values. Your Excel will show a different winner and numberSyntax
=СЛЧИС() — no arguments. A decimal greater than or equal to 0 and less than 1: 0.3814… You still type the brackets.
=СЛУЧМЕЖДУ(bottom; top) — a random whole number in a range.
- bottom — the smallest possible number (it can come up itself).
- top — the largest possible number (it can come up too). If it is less than bottom — #NUM!.
Both are volatile: they produce a new value whenever any cell changes, when you press F9 and when the file opens.
Entering RANDBETWEEN step by step
1
Select B2. Формулы → Математические → RANDBETWEEN.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Student | Score | ||
| 2 | Aziz | |||
| 3 | Dilnoza | |||
| 4 | ||||
| 5 |
2
Enter 60 for Bottom and 100 for Top, then click OK — a random score from 60 to 100.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Student | Score | ||
| 2 | Aziz | 87 | ||
| 3 | Dilnoza | |||
| 4 | ||||
| 5 |
3
Fill the formula down. Press F9 — every number changes. That is proof the random numbers are “live”.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Score (60–100) | Date (2025) | Price (sum) | |
| 2 | 97 | 05.04.2025 | 13 200 | |
| 3 | 79 | 25.10.2025 | 8 600 | |
| 4 | 98 | 18.10.2025 | 10 400 | |
| 5 | 73 | 04.09.2025 | 9 600 | |
| 6 |
=СЛУЧМЕЖДУ(60;100); B: =СЛУЧМЕЖДУ(ДАТА(2025;1;1);ДАТА(2025;12;31)) — a date is a number too; C: =ОКРУГЛ(5000+СЛЧИС()*10000;-2)| A | B | C | D | |
|---|---|---|---|---|
| 1 | Question | Random (value) | Order | |
| 2 | Question 1 | 0,7312 | 2 | |
| 3 | Question 2 | 0,1845 | 5 | |
| 4 | Question 3 | 0,9027 | 1 | |
| 5 | Question 4 | 0,4471 | 4 | |
| 6 | Question 5 | 0,0659 | 6 | |
| 7 | Question 6 | 0,5583 | 3 | |
| 8 |
=СЛЧИС() and then frozen with Paste Values. RANK gives a unique order number — or just sort by column B| A | B | C | D | |
|---|---|---|---|---|
| 1 | Customer | Random | Promo (30%) | |
| 2 | Aziz | 0,49 | — | |
| 3 | Dilnoza | 0,12 | Gift | |
| 4 | Javohir | 0,59 | — | |
| 5 | Malika | 0,93 | — | |
| 6 | Sardor | 0,27 | Gift | |
| 7 | Nodira | 0,92 | — | |
| 8 |
=СЛЧИС() results. A value below 0.3 comes up 30% of the time, so across many customers roughly every third one gets a giftPro level: RANDARRAY, picks without repeats and simulation
- RANDARRAY (Excel 365):
=RANDARRAY(10;1;1;100;ИСТИНА)— one formula spills 10 whole numbers down a column. Arguments: rows, columns, min, max, whole numbers. - Random numbers without repeats:
=SORTBY(ПОСЛЕДОВ(10);RANDARRAY(10))— 1 to 10 in random order, none repeated. Shuffle a list:=SORTBY(A2:A20;RANDARRAY(ЧСТРОК(A2:A20))). - A random item from a list:
=ИНДЕКС(A2:A50;СЛУЧМЕЖДУ(1;СЧЁТЗ(A2:A50)))— adapts to the list length. - Normal distribution:
=NORM.INV(СЛЧИС();1000;150)— “realistic” sales with average 1,000 and deviation 150. Over thousands of rows this is a simple Monte Carlo simulation. - Stop automatic recalculation: Формулы → Calculation Options → Manual. Numbers now change only when you press F9.
Try it in the simulator
Type =СЛУЧМЕЖДУ(60;100) in B2 and fill it down to B6. Type =СРЗНАЧ(B2:B6) in B7. Now type anything in D1 — you’ll see every score and the average recalculate.
| A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Student | Score | ||||||||||||||||||||||
| 2 | Aziz | |||||||||||||||||||||||
| 3 | Dilnoza | |||||||||||||||||||||||
| 4 | Javohir | |||||||||||||||||||||||
| 5 | Malika | |||||||||||||||||||||||
| 6 | Sardor | |||||||||||||||||||||||
| 7 | Average | |||||||||||||||||||||||
| 8 | ||||||||||||||||||||||||
| 9 | ||||||||||||||||||||||||
| 10 | ||||||||||||||||||||||||
| 11 |
Has ExcelLab been useful?
Support the project and help us release new lessons and exercises.