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.