Excel tutorial
/

Functions

Intermediate

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.

Книга1 - Excel
—☐✕
C2fxMalika
ABCD
1CustomerWinner
2AzizMalika
3Dilnoza
4JavohirRandom number
5Malika0,7109
6Sardor
7Nodira
8
Готово
C2 held =ИНДЕКС(A2:A7;СЛУЧМЕЖДУ(1;6)) and C5 =СЛЧИС() — the results were frozen with Paste Values. Your Excel will show a different winner and number

Syntax

=СЛЧИС() — 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.

Книга1 - Excel
—☐✕
ФайлГлавнаяВставкаРазметка страницыФормулыДанныеРецензированиеВидСправка
Вставить функциюАвтосуммаФинансовыеЛогическиеТекстовыеДата и времяСсылки и массивыМатематические
Библиотека функций
Диспетчер имён
Определённые имена
B2fx
ABCD
1StudentScore
2Aziz
3Dilnoza
4
5
Готово

2

Enter 60 for Bottom and 100 for Top, then click OK — a random score from 60 to 100.

Книга1 - Excel
—☐✕
B2fx87
ABCD
1StudentScore
2Aziz87
3Dilnoza
4
5
Готово

3

Fill the formula down. Press F9 — every number changes. That is proof the random numbers are “live”.

Книга1 - Excel
—☐✕
B2fx45752
ABCD
1Score (60–100)Date (2025)Price (sum)
29705.04.202513 200
37925.10.20258 600
49818.10.202510 400
57304.09.20259 600
6
Готово
Example 1: test data (converted to values). A: =СЛУЧМЕЖДУ(60;100); B: =СЛУЧМЕЖДУ(ДАТА(2025;1;1);ДАТА(2025;12;31)) — a date is a number too; C: =ОКРУГЛ(5000+СЛЧИС()*10000;-2)
Книга1 - Excel
—☐✕
C2fx=РАНГ(B2;$B$2:$B$7)
ABCD
1QuestionRandom (value)Order
2Question 10,73122
3Question 20,18455
4Question 30,90271
5Question 40,44714
6Question 50,06596
7Question 60,55833
8
Готово
Example 2: shuffling. Column B was filled with =СЛЧИС() and then frozen with Paste Values. RANK gives a unique order number — or just sort by column B
Книга1 - Excel
—☐✕
C2fx=ЕСЛИ(B2<0,3;"Gift";"—")
ABCD
1CustomerRandomPromo (30%)
2Aziz0,49—
3Dilnoza0,12Gift
4Javohir0,59—
5Malika0,93—
6Sardor0,27Gift
7Nodira0,92—
8
Готово
Example 3: probability. Column B holds frozen =СЛЧИС() results. A value below 0.3 comes up 30% of the time, so across many customers roughly every third one gets a gift

Pro 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.

Книга1 - Excel
—☐✕
Буфер обмена
Шрифт
Выравнивание
Число
Стили
Ячейки
Редактирование
✕✓fx
ABCDEFGHIJKLMNOPQRSTUVWX
1StudentScore
2Aziz
3Dilnoza
4Javohir
5Malika
6Sardor
7Average
8
9
10
11
Лист1
Готово

Has ExcelLab been useful?

Support the project and help us release new lessons and exercises.

Support us
Previous

131 / 154