Skip to content

OFFSET

Returns a reference that starts a set number of rows and columns from a cell and can be resized. It is volatile, so it recalculates constantly.

Syntax

=OFFSET(, , , , )

Lookup and reference

Every version of Excel, including Microsoft 365, Excel 2024, 2021, 2019, 2016 and earlier, Excel for the web and the mobile apps.

Try it

Edit the formula in D5 or change the inputs. The sheet recalculates as you type.

D5
A
B
C
D
1
Month
Units
Month no.
2
Jan
410
4
3
Feb
385
4
Mar
462
Units
5
Apr
498
498
6
May
455
7
8
9

D5 =OFFSET(B1,D2,0) returns 498

How OFFSET works

OFFSET starts at a cell, moves a number of rows and columns away, and returns the cell or block it lands on, optionally resized. =OFFSET(B1, 3, 0) returns B4. =OFFSET(B1, 1, 0, 3, 1) returns the three cells B2:B4.

It was once the standard way to build ranges that grow as data is added, such as a total over "however many months have been entered". It still works, but it comes with a cost you need to know about.

The arguments

  • reference is the starting cell or range. Movement is counted from its top-left corner.
  • rows and cols are how far to move. Positive goes down and right, negative goes up and left.
  • height and width resize the result. Leave them out and the result is as big as reference.

If the result would fall off the edge of the sheet, OFFSET returns #REF!. OFFSET returns a reference, so you can feed it to SUM or AVERAGE. In current Excel a formula that is just OFFSET with a multi-cell result spills.

Why OFFSET is volatile

OFFSET is a volatile function. Most formulas recalculate only when a cell they depend on changes. A volatile function recalculates every time Excel recalculates anything in the workbook, even when nothing it depends on has changed. Excel does this because OFFSET's result depends on numbers and cells that can change which cells it points at, so it can't tell in advance which edits matter.

The cost grows with the workbook:

  • Every formula that depends on an OFFSET also recalculates every time, so one volatile cell can drag a whole chain of formulas with it.
  • Large models with many OFFSETs become slow to edit and to open.
  • Excel treats the workbook as changed after every recalculation, so you may be asked to save even if you did nothing.
  • Trace Precedents can't reliably show what an OFFSET reads, which makes models harder to audit.

When to avoid it

Avoid OFFSET in large or shared models, anywhere a lot of formulas depend on its result, and anywhere a Table or INDEX will do the job. A few OFFSETs in a small workbook are fine.

The usual replacements:

  • A growing range: convert the data to a Table and reference the column, or use =SUM(B2:INDEX(B2:B100, COUNT(B2:B100))). INDEX isn't volatile.
  • A single cell by position: =INDEX(B2:B100, n).
  • A lookup: XLOOKUP, or INDEX with MATCH.
  • A filtered or sorted list: the dynamic array functions such as FILTER and TAKE.

The related function INDIRECT has the same volatility problem.

Arguments

reference
The starting point, a cell or range such as B1. The movement is counted from its top-left cell.
rows
How many rows to move. Positive moves down, negative moves up, 0 stays on the same row.
cols
How many columns to move. Positive moves right, negative moves left, 0 stays in the same column.
heightoptional
How many rows tall the result should be. If you leave it out, it is as tall as reference.
widthoptional
How many columns wide the result should be. If you leave it out, it is as wide as reference.

Examples

Each example is a live sheet. Change the inputs or the formula and watch the result.

Example 1

Move from a cell: a single value by position

D5 =OFFSET(B1,D2,0)

Result: 498

OFFSET starts at B1 and moves down 4 rows and 0 columns, landing on B5. The header row is row 0, so month number 4 is 4 rows down.

D5
A
B
C
D
1
Month
Units
Month no.
2
Jan
410
4
3
Feb
385
4
Mar
462
Units
5
Apr
498
498
6
May
455
7
8
9

D5 =OFFSET(B1,D2,0) returns 498

Example 2

Resize: add up a block of cells

D5 =SUM(OFFSET(B2,0,0,D2,1))

Result: 1257

Starting at B2, the result is D2 rows tall and 1 column wide, so with D2 = 3 it covers B2:B4. SUM adds 410, 385 and 462.

D5
A
B
C
D
1
Month
Units
Months to add
2
Jan
410
3
3
Feb
385
4
Mar
462
Total
5
Apr
498
1257
6
May
455
7
8
9

D5 =SUM(OFFSET(B2,0,0,D2,1)) returns 1257

Example 3

A range that grows with the data

D2 =AVERAGE(OFFSET(B1,COUNT(B2:B11)-2,0,3,1))

Result: 471.666666666667

COUNT counts 5 entries, so OFFSET moves down 3 rows from B1 and takes 3 cells: B4:B6. Add a sixth month and the window moves by itself. INDEX can do the same without being volatile.

D2
A
B
C
D
1
Month
Units
Average of the latest 3 months
2
Jan
410
471.6666667
3
Feb
385
4
Mar
462
5
Apr
498
6
May
455
7
8
9
10
11
12

D2 =AVERAGE(OFFSET(B1,COUNT(B2:B11)-2,0,3,1)) returns 471.666666666667

Example 4

The same job without OFFSET, using INDEX

D2 =AVERAGE(INDEX(B2:B11,COUNT(B2:B11)-2):INDEX(B2:B11,COUNT(B2:B11)))

Result: 471.666666666667

INDEX returns references, so two of them joined by a colon make a range. The answer matches the OFFSET version, but INDEX is not volatile and recalculates only when B2:B11 changes.

D2
A
B
C
D
1
Month
Units
Average of the latest 3 months
2
Jan
410
471.6666667
3
Feb
385
4
Mar
462
5
Apr
498
6
May
455
7
8
9
10
11
12

D2 =AVERAGE(INDEX(B2:B11,COUNT(B2:B11)-2):INDEX(B2:B11,COUNT(B2:B11))) returns 471.666666666667

Your turn.

Solve it in the sheet. Every answer is checked, with hints if you need them.

Task 1 of 2

In E2, use OFFSET to return the units for the month number in D2. Start from the Units heading in B1.

Answer in E2.

E2
A
B
C
D
E
F
1
Month
Units
Month no.
2
Jan
410
3
3
Feb
385
4
Mar
462
Average of latest 3
5
Apr
498
6
May
455
7
Jun
471
8
Jul
520
9
Aug
508
10
Sep
11
Oct
12
Nov
13
Dec
14

Common mistakes

  • OFFSET is volatile: it recalculates on every change anywhere in the workbook, and so does every formula that depends on it. In a large model that makes editing slow. Prefer INDEX or Tables.
  • Moving off the edge of the sheet, such as a negative row above row 1, returns #REF!.
  • Inserting rows or columns doesn't update the numbers inside OFFSET. A hard-coded 3 that meant "three rows down" still means three rows down after the layout changes.
  • OFFSET hides what it reads from Trace Precedents, so a reviewer can't easily see what the formula reads.
  • The window can include header or blank cells if your count is off by one. Test the formula with the first and last rows.

Questions people ask

Why is OFFSET volatile?

Its result depends on arguments that can change which cells it points at, so Excel can't tell which edits matter. It therefore recalculates OFFSET, and everything that depends on it, every time the workbook recalculates.

Does OFFSET slow down Excel?

A few OFFSET formulas in a small workbook make no visible difference. Hundreds of them, or a few that thousands of formulas depend on, can make a large workbook slow to edit and open.

What can I use instead of OFFSET?

For a growing range, use a Table or INDEX: `B2:INDEX(B2:B100, COUNT(B2:B100))`. For one cell by position, use INDEX. For lookups, use XLOOKUP or INDEX/MATCH.

Why does OFFSET return #REF!?

The result would fall outside the sheet, such as a row above row 1. Check the rows and cols arguments.

Can OFFSET return more than one cell?

Yes. Give a height and width. Wrap it in a function such as SUM or AVERAGE, or in current Excel, enter it on its own and the result spills.

Learn OFFSET in a real sheet.

Tracks take you from the basics to modelling, one graded exercise at a time.