The Excel OFFSET function returns a reference to a range constructed in parts: a starting point, a row and column offset, and a final height and width in rows and columns. OFFSET is handy in formulas that dynamically average or sum “last n values”.
Syntax:=OFFSET (reference, rows, cols, [height], [width])
The OFFSET function syntax has the following arguments:
- Reference Required. The reference from which you want to base the offset. Reference must refer to a cell or range of adjacent cells; otherwise, OFFSET returns the #VALUE! error value.
- Rows Required. The number of rows, up or down, that you want the upper-left cell to refer to. Using 5 as the rows argument specifies that the upper-left cell in the reference is five rows below reference. Rows can be positive (which means below the starting reference) or negative (which means above the starting reference).
- Cols Required. The number of columns, to the left or right, that you want the upper-left cell of the result to refer to. Using 5 as the cols argument specifies that the upper-left cell in the reference is five columns to the right of reference. Cols can be positive (which means to the right of the starting reference) or negative (which means to the left of the starting reference).
- Height Optional. The height, in number of rows, that you want the returned reference to be. Height must be a positive number.
Width Optional. The width, in number of columns, that you want the returned reference to be. Width must be a positive number.
Example: Let’s look at some Excel OFFSET function examples and explore how to use the OFFSET function as a worksheet function in Microsoft Excel:
Based on the Excel spreadsheet above, the following OFFSET examples would return:
- OFFSET only returns a reference, no cells are moved.
- Both rows and cols can be supplied as negative numbers to reverse their normal offset direction – negative cols offset to the left, and negative rows offset above.
- OFFSET is a “volatile” formula; it is recalculated whenever there is any change to a worksheet. It can slow down Excel in a complicated worksheet.
- OFFSET will display the #REF! error value if the offset is outside the edge of the worksheet.
- When height or width is omitted, the height and width of reference is used.
- OFFSET can be used with any other function that expects to receive a reference.