Excel tutorial
/

Functions

Advanced

How to use OFFSET in Excel: shifting and dynamic ranges

OFFSET moves from a starting cell and returns a range of the size you need: last-3-months totals, growing lists. Its traps and the faster INDEX alternative.

OFFSET returns a range, not a value. You give it directions: “from B1 go down 4 rows, right 0 columns, and take a range 3 rows tall from there”.

Why it matters: the boundaries of the range are calculated by a formula. In a report that gains a row every month, the “last 3 months total” moves by itself, and a drop-down list grows with new products automatically.

OFFSET almost always lives inside another function — SUM, AVERAGE, COUNT — which then calculates the range OFFSET returned.

Книга1 - Excel
—☐✕
B5fx150
ABCDE
1MonthSales1Last 3 months
2Jan120481
3Feb135
4Mar149
5Apr1502
6May171
7Jun160
8
ГотовоСреднее: 160,3333Количество: 3Сумма: 481
D2: =SUM(OFFSET(B1,COUNT(B2:B13)-2,0,3,1)). From B1 (1) it goes down 6−2=4 rows (2) and takes 3 rows: B5:B7 → 481 million soums

Syntax

=СМЕЩ(reference; rows; cols; [height]; [width])

  • reference — the starting point: a cell or a range.
  • rows — how many rows to move: positive goes down, negative goes up, 0 stays put.
  • cols — how many columns to move: positive goes right, negative goes left.
  • height — the height of the returned range (number of rows). If omitted, the same as reference.
  • width — the width (number of columns). If omitted, the same as reference.

The move is counted from the starting cell: rows = 1 is the next row, 0 is the same row.

How OFFSET “walks”: =СМЕЩ(A1;2;1;3;2)

1

You can enter the formula via Формулы → Ссылки и массивы → OFFSET.

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

2

Arguments: Reference — A1, Rows — 2, Cols — 1, Height — 3, Width — 2.

Книга1 - Excel
—☐✕
A1fxStore
ABCDE
1StoreJanFebMar
2Chilanzar524861
3Yunusabad445047
4Sergeli384145
5Yakkasaray575563
6Almazar404339
7
Готово

3

Excel walks like this: from A1 (1) down 2 rows to A3 (2), right 1 column to B3 (3), and takes a range 3 rows × 2 columns from there: B3:C5. =СУММ(СМЕЩ(A1;2;1;3;2)) adds up those 6 cells — 285.

Книга1 - Excel
—☐✕
B3fx44
ABCDE
1Store1JanFebMar
2Chilanzar524861
3Yunusabad24435047
4Sergeli384145
5Yakkasaray575563
6Almazar404339
7
ГотовоСреднее: 47,5Количество: 6Сумма: 285

4

In a cell on its own, =СМЕЩ(A1;2;1) shows the value of a single cell (B3) — 44. If the range covers several cells, Excel 365 spills the result into neighbouring cells, while older versions return #VALUE!. That’s why OFFSET belongs inside SUM, AVERAGE and similar functions.

Example: the “last 3 months” move by themselves

The formula: =СУММ(СМЕЩ(B1;СЧЁТ(B2:B13)-2;0;3;1))

  • COUNT(B2:B13) — how many months have been entered (6 in June).
  • -2 — to land on the first of the last three: 6−2=4 rows below B1 is B5 (April).
  • 3,1 — 3 rows, 1 column.

Type July’s sales into B8, COUNT becomes 7, and the range shifts to B6:B8 (May–July) on its own. No need to touch the formula.

Книга1 - Excel
—☐✕
B6fx171
ABCDE
1MonthSalesLast 3 months
2Jan120516
3Feb135
4Mar149
5Apr150
6May171
7Jun160
8Jul1851
9
ГотовоСреднее: 172Количество: 3Сумма: 516
July was added (1) — the same formula now sums B6:B8: 171 + 160 + 185 = 516

Pro level: INDEX instead of OFFSET

INDEX also returns a reference, so two INDEXes joined with a colon build the same dynamic range — and it is not volatile:

=СУММ(ИНДЕКС(B2:B13;СЧЁТ(B2:B13)-2):ИНДЕКС(B2:B13;СЧЁТ(B2:B13)))

The first INDEX is the start of the range (3rd month from the end), the second is the end (the latest month).

When OFFSET is still handy:

  • A dynamic name. In Диспетчер имён, create a name with the formula =СМЕЩ($A$2;0;0;СЧЁТЗ($A:$A)-1;1) and use it as the source of a drop-down list (Data Validation) — the list grows with new values on its own.
  • A moving average. =СРЗНАЧ(СМЕЩ(B2;0;0;3;1)) filled down gives the average of the next 3 months on every row.

The modern alternative: turn the data into a Table (Ctrl + T) — it expands by itself, and often you don’t need OFFSET at all.

Книга1 - Excel
—☐✕
E2fx516
ABCDEF
1MonthSalesMeasureValue
2Jan120Last 3 months total516
3Feb135Last 3 months average172,0
4Mar149
5Apr150
6May171
7Jun160
8Jul185
9
ГотовоСреднее: 344Количество: 2Сумма: 688
E2: =SUM(INDEX(B2:B13,COUNT(B2:B13)-2):INDEX(B2:B13,COUNT(B2:B13))), E3 is the same with AVERAGE. Same result as OFFSET: 516 and 172.0 — but it only recalculates when column B changes

Try it in the simulator

A non-volatile way without OFFSET. Column C holds the month number. Type =ИНДЕКС(B2:B13;СЧЁТ(B2:B13)) in E2 — the latest month’s sales (160). Type =СУММЕСЛИМН(B2:B13;C2:C13;">"&СЧЁТ(B2:B13)-3) in E3 — the last 3 months total (481). Then enter July’s sales of 185 in B8: both results update by themselves.

Книга1 - Excel
—☐✕
Буфер обмена
Шрифт
Выравнивание
Число
Стили
Ячейки
Редактирование
✕✓fx
ABCDEFGHIJKLMNOPQRSTUVWX
1MonthSalesNoMeasureValue
2Jan1201Latest month
3Feb1352Last 3 months total
4Mar1493
5Apr1504
6May1715
7Jun1606
8Jul7
9
10
11
12
Лист1
Готово

Has ExcelLab been useful?

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

Support us
Previous

102 / 154