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.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Month | Sales1 | Last 3 months | ||
| 2 | Jan | 120 | 481 | ||
| 3 | Feb | 135 | |||
| 4 | Mar | 149 | |||
| 5 | Apr | 1502 | |||
| 6 | May | 171 | |||
| 7 | Jun | 160 | |||
| 8 |
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 asreference.width— the width (number of columns). If omitted, the same asreference.
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.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Store | Jan | Feb | Mar | |
| 2 | Chilanzar | 52 | 48 | 61 | |
| 3 | Yunusabad | 44 | 50 | 47 | |
| 4 | |||||
| 5 |
2
Arguments: Reference — A1, Rows — 2, Cols — 1, Height — 3, Width — 2.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Store | Jan | Feb | Mar | |
| 2 | Chilanzar | 52 | 48 | 61 | |
| 3 | Yunusabad | 44 | 50 | 47 | |
| 4 | Sergeli | 38 | 41 | 45 | |
| 5 | Yakkasaray | 57 | 55 | 63 | |
| 6 | Almazar | 40 | 43 | 39 | |
| 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.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Store1 | Jan | Feb | Mar | |
| 2 | Chilanzar | 52 | 48 | 61 | |
| 3 | Yunusabad2 | 443 | 50 | 47 | |
| 4 | Sergeli | 38 | 41 | 45 | |
| 5 | Yakkasaray | 57 | 55 | 63 | |
| 6 | Almazar | 40 | 43 | 39 | |
| 7 |
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.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Month | Sales | Last 3 months | ||
| 2 | Jan | 120 | 516 | ||
| 3 | Feb | 135 | |||
| 4 | Mar | 149 | |||
| 5 | Apr | 150 | |||
| 6 | May | 171 | |||
| 7 | Jun | 160 | |||
| 8 | Jul | 1851 | |||
| 9 |
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.
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | Month | Sales | Measure | Value | ||
| 2 | Jan | 120 | Last 3 months total | 516 | ||
| 3 | Feb | 135 | Last 3 months average | 172,0 | ||
| 4 | Mar | 149 | ||||
| 5 | Apr | 150 | ||||
| 6 | May | 171 | ||||
| 7 | Jun | 160 | ||||
| 8 | Jul | 185 | ||||
| 9 |
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.
| 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 | Month | Sales | No | Measure | Value | |||||||||||||||||||
| 2 | Jan | 120 | 1 | Latest month | ||||||||||||||||||||
| 3 | Feb | 135 | 2 | Last 3 months total | ||||||||||||||||||||
| 4 | Mar | 149 | 3 | |||||||||||||||||||||
| 5 | Apr | 150 | 4 | |||||||||||||||||||||
| 6 | May | 171 | 5 | |||||||||||||||||||||
| 7 | Jun | 160 | 6 | |||||||||||||||||||||
| 8 | Jul | 7 | ||||||||||||||||||||||
| 9 | ||||||||||||||||||||||||
| 10 | ||||||||||||||||||||||||
| 11 | ||||||||||||||||||||||||
| 12 |
Has ExcelLab been useful?
Support the project and help us release new lessons and exercises.