OFFSET
Short answer
Shift and resize a range, at a recalculation cost
OFFSET(reference, rows, cols, [height], [width])
- Category
- Lookup & Reference
- Excel version
- All versions
- Also searched as
- rolling range, rolling 12 months, volatile function, dynamic range, dynamic named range, moving window, last n months, offset replacement
What it returns
OFFSET returns a reference that starts a given number of rows and columns away from a starting cell, optionally resized. =OFFSET(N10, 0, -11, 1, 12) starts at N10, moves 11 columns left to C10, and returns a range one row tall and twelve columns wide: C10:N10.
Wrapped in SUM or AVERAGE, that gives a window that moves as the formula is filled across. It is the textbook rolling 12-month total.
The cost is that OFFSET is volatile. Excel recalculates it, and every cell downstream of it, on every edit anywhere in the workbook, whether or not anything it reads has changed. One OFFSET is free. A row of them across 36 months on 40 line items is a model that pauses after every keystroke.
Arguments that matter
| Argument | Required | What it does |
|---|---|---|
reference | Yes | The anchor cell or range the move starts from. |
rows | Yes | Rows to move. Positive is down, negative is up, 0 stays. |
cols | Yes | Columns to move. Positive is right, negative is left. |
height | No | Rows in the returned range. Defaults to the height of reference. |
width | No | Columns in the returned range. Defaults to the width of reference. |
The returned range has to sit on the sheet. Move off the top or left edge and OFFSET returns #REF!.
In a financial model
OFFSET counts cells. It has no idea what the cells mean. A window of twelve columns is twelve months only while nobody inserts a subtotal column inside it.
Where it still turns up, and what replaces it:
- Rolling 12-month totals across month columns. Replace with
start:INDEX(...), or with SUMIFS on the date headers, which ignores subtotal columns entirely. The rolling 12-month totals guide builds both. - Year-to-date ranges driven by a period selector. Replace with
SUM(first:INDEX(row, position)). - Dynamic named ranges for charts and dropdown lists. Replace with an Excel table, which grows on its own, or with TRIMRANGE in Excel 365.
- Last n months for a trend average. Replace with TAKE in Excel 365, or the INDEX pattern in older versions.
The audit cost is as real as the speed cost. Trace Precedents on an OFFSET formula points at the anchor cell, not at the twelve cells it actually reads. Avoid volatile functions treats OFFSET in the calculation layer as a review finding for both reasons.
Worked example
A P&L on one tab with months across C to AL (Jul-23 to Jun-26) and revenue in row 10. Rolling 12-month revenue for the column N month, the OFFSET way:
=SUM(OFFSET(N10, 0, -11, 1, 12))
Fill it right and the window moves one month at a time. It is correct until a column goes in between C and N.
The INDEX version reads the same twelve cells:
=SUM(INDEX($C10:$AL10, COLUMNS($C10:N10)-11):N10)
COLUMNS($C10:N10) is 12 in column N, so INDEX returns C10 and the range is C10:N10. Fill right and both ends move. The formula is non-volatile: it recalculates only when a cell in row 10 changes.
The first eleven columns have fewer than twelve months behind them, and the position goes to 0 or below. A 0 would make INDEX return the whole row. Clamp it, and count the months next to the total so a short window is not read as a decline:
=SUM(INDEX($C10:$AL10, MAX(1, COLUMNS($C10:N10)-11)):N10)
A dropdown list on tab Lists with a header in A1 and names below, built the old way:
=OFFSET(Lists!$A$2, 0, 0, COUNTA(Lists!$A:$A)-1, 1)
Convert the list to a table named Entities. Data validation will not take a table reference directly, so in Excel 2021 or 365 put =SORT(Entities[Name]) in a helper cell such as Lists!$D$2 and set the validation source to =Lists!$D$2#. The spill grows with the table, with no volatile anchor.
Old way vs new way
The last three months’ average for a trend line, OFFSET:
=AVERAGE(OFFSET(N10, 0, -2, 1, 3))
Excel 365, TAKE:
=AVERAGE(TAKE($C10:N10, , -3))
Both count columns, so neither survives a subtotal column. TAKE is non-volatile and says what it does in plain words. When the layout has subtotals, use SUMIFS or AVERAGEIFS on the date headers instead.
Where it breaks
The model pauses after every edit. Hundreds of OFFSET formulas, plus everything that depends on them, recalculate on each keystroke. Fix: replace them with INDEX ranges. Switching to manual calculation hides the symptom and creates a stale-numbers risk, per manual calculation is a decision.
A rolling 12 total drops by a month’s worth. A quarterly subtotal column was inserted inside the window, so twelve columns now hold eleven months and a subtotal. Fix: drive the window by dates with SUMIFS, or keep subtotal columns out of month blocks.
OFFSET returns #REF! in the first columns. The negative column move points off the left edge of the sheet. Fix: clamp the start position, or start the window from a range that has room.
The total is right, but nobody can trace it. Trace Precedents shows the anchor, not the range read. Fix: rewrite the range as start:INDEX(...), where both ends of the reachable range are written in the formula.
A dynamic named range picks up a stray value. COUNTA on a whole column counts a note typed three hundred rows down, and the list grows by a blank. Fix: use a table, so the range is the table and nothing else.
Recalculation stays slow after OFFSET is gone. Other volatile functions remain: INDIRECT, TODAY, NOW, RAND. Fix: search the workbook for each one and give the survivors a reason to exist. INDIRECT has its own case against it.
Related functions
- INDEX. Builds the same moving ranges as
start:INDEX(...), non-volatile and traceable. The default replacement. - TAKE. First or last n rows or columns in Excel 365. A tidy last-12 or last-3 for a summary cell.
- SUMIFS. Defines the window by dates instead of by column count, which is the only version that survives an inserted subtotal.
- TRIMRANGE. Trims blank edges off a range in Excel 365, the modern answer to the OFFSET and COUNTA named range.
- INDIRECT. The other volatile reference builder, with an even worse audit trail.
- The play avoid volatile functions lists the volatile set and what replaces each one.
