OFFSET
Returns a reference shifted from a starting reference by rows and columns.
OFFSET is volatile and returns a reference that can point to a single cell or a resized
range, depending on the optional height and width arguments.
The Formualizer engine in this repository at 0.15.0 plus unreleased changes computes the example results. Known differences from Excel are listed on this page.
Syntax
=OFFSET(reference, rows, cols, [height], [width])
Arguments
| Argument | Type | Required | Default |
|---|---|---|---|
reference | range (range) | Required | — |
rows | number | Required | — |
cols | number | Required | — |
height | number | Optional | — |
width | number | Optional | — |
Return type
Can return a reference when evaluated in a reference context.
Remarks
rowsandcolsshift from the top-left ofreference.- If omitted,
heightandwidthdefault to the original reference size. - Offset/size inputs coerce like Excel: a blank is
0,TRUEis1and numeric text is parsed; other text returns#VALUE!. - In value context, a 1x1 result returns a scalar; larger results spill as an array.
Error cases
- Non-positive target coordinates or dimensions return
#REF!, and so does a result that extends past the last row or column of the sheet.
Examples
Move one row down and one column right from the anchor.
Formula =OFFSET(A1,1,1)
| B | |
|---|---|
| 2 | 42 |
Expected result 42
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Supply the height and width to sum a two-row offset range.
Formula =SUM(OFFSET(A1,1,0,2,1))
| A | |
|---|---|
| 2 | 20 |
| 3 | 30 |
Expected result 50
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Zero offsets leave the reference anchored at the input cell.
Formula =OFFSET(A1,0,0)
| A | |
|---|---|
| 1 | 10 |
Expected result 10
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Moving above the first row creates an invalid reference.
Formula =OFFSET(A1,-1,0)
Expected result #REF!
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Offset and resize a range
Formula =SUM(OFFSET(A1,1,0,2,2))
| A | B | |
|---|---|---|
| 2 | 2 | 5 |
| 3 | 3 | 6 |
Expected result 16
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Related functions
FAQ
What defaults are used when height and width are omitted?
OFFSET keeps the source reference size, then applies the row/column shift to that same-sized block.
When does OFFSET return #REF!?
It returns #REF! if the shifted start goes to row/column <= 0, if requested height/width are non-positive, or if the result extends past the edge of the sheet.