How to Use the OFFSET Function in Google Sheets | Reference a Range Shifted from a Starting Cell
How to Use the OFFSET Function
The OFFSET function returns a cell or a range of a specified height and width that is shifted by a given number of rows and columns from a starting reference cell.
Syntax
=OFFSET(cell_reference, offset_rows, offset_columns, [height], [width])
- cell_reference: The starting cell or cell range (required).
- offset_rows: The number of rows to shift up or down from the starting cell as an integer (required). Positive numbers shift down; negative numbers shift up.
- offset_columns: The number of columns to shift left or right from the starting cell as an integer (required). Positive numbers shift right; negative numbers shift left.
- height: The number of rows (vertical size) of the returned range, as an integer of
1or greater (optional). - width: The number of columns (horizontal size) of the returned range, as an integer of
1or greater (optional).
Example Using a Table
Here is an example of dynamically calculating the total sales for the “most recent 3 days” from the daily sales table below (using COUNT(B2:B6) to get the number of entries).
| Row | Column A (Date) | Column B (Sales) |
|---|---|---|
| 1 | Date | Sales |
| 2 | 11/01 | 10,000 |
| 3 | 11/02 | 15,000 |
| 4 | 11/03 | 12,000 |
| 5 | 11/04 | 20,000 |
| 6 | 11/05 | 18,000 |
- Formula:
=SUM(OFFSET(B1, COUNT(B2:B6)-2, 0, 3, 1)) - Result:
50,000(starts5-2=3rows belowB1atB4, and sums the 3-row by 1-column rangeB4:B6)
Common Errors and Notes
- Shifting Outside Sheet Boundaries (
#REF!Error): Shifting negatively past row 1 or Column A points to an invalid cell location and causes a#REF!error. - Using Multi-Cell Ranges Directly: When
heightorwidthis2or more,OFFSETreturns a cell range, so it is typically wrapped inside another function such asSUMorAVERAGE. - Performance Impact as a Volatile Function: Because
OFFSETrecalculates on every sheet edit, heavy use across thousands of rows can slow down your spreadsheet. For slicing a fixed-anchor range, usingINDEX(e.g.,B2:INDEX(B:B, 6)) runs faster.
Frequently Asked Questions
Q. Is it true that using OFFSET slows down Google Sheets?
A. Yes, it is true. OFFSET is a "volatile function," meaning it recalculates every time any cell in the sheet is edited. Using it in large quantities can slow down performance, so it is recommended to use INDEX as an alternative whenever possible.
Q. Can OFFSET shift upward or to the left?
A. Yes, it can. By specifying negative numbers such as "-1" or "-2" for the row or column offset, you can reference cells shifted upward (negative rows) or to the left (negative columns) from the starting cell.