What is the OFFSET function?
=OFFSET(reference, rows, cols, [height], [width])OFFSET returns the cell or range that is a given number of rows down and columns to the right of a reference cell.
Give a height and width and it becomes a range of that size, which you can use as a moving range inside SUM or AVERAGE. Watch the move on the sheet above.
Arguments
- reference
- The starting cell or range.
- rows
- How many rows to move down. Negative moves up.
- cols
- How many columns to move right. Negative moves left.
- height
- The number of rows in the returned range. Omitted means the same as reference.
- width
- The number of columns in the returned range. Omitted means the same as reference.
OFFSET examples
Example 1. A single cell
=OFFSET(A1, 4, 2)Moving 4 down and 2 right reaches C5, whose value is 6900.
Example 2. Sum a range
=SUM(OFFSET(C1, 1, 0, 3, 1))The sum of C2:C4, 7000.
Example 3. Average of the last 3
=AVERAGE(OFFSET(C1, COUNT(C:C)-2, 0, 3))Averages the last 3 values even as data grows.
Common mistakes
Forgetting it counts from 0
rows 1 is the cell just below. The reference cell itself is 0.
Slower calculation
OFFSET also recalculates whenever the sheet changes. Use INDEX when you can.
FAQ
- What if it goes off the sheet?
- You get #REF!.
- What if height is negative?
- The range extends upward.