How to Use the OFFSET Function in Excel

This guide provides a comprehensive overview of the OFFSET function in Microsoft Excel and Google Sheets, a powerful tool used for dynamically referencing a range of cells.

Overview

The OFFSET function is a valuable resource in Excel and Google Sheets, designed to return a reference to a cell or cell range located a specific distance from a starting cell or range. This feature is invaluable for producing dynamic ranges, which can automatically adapt to additions or changes in data and the structure of your spreadsheet.

Syntax

The syntax for the OFFSET function is consistent across both Excel and Google Sheets:

=OFFSET(reference, rows, cols, [height], [width])
  • reference: Specifies the starting cell or range of cells from which the offset will be calculated.
  • rows: The number of rows to move from the reference. Use a positive value to move down and a negative value to move up.
  • cols: The number of columns to move from the reference. A positive value moves to the right, while a negative value moves to the left.
  • height (optional): The number of rows in the returned reference range.
  • width (optional): The number of columns in the returned reference range.

Examples

Dynamic Sum Range

Consider a scenario with a column of numbers in cells A1:A5, and you need a dynamic sum range that consistently includes the last 3 numbers in the column.

Data Formula
10 =SUM(OFFSET(A1, COUNTA(A:A)-3, 0, 3, 1))

This formula uses COUNTA(A:A) to count all non-empty cells in column A. The OFFSET function then references a cell that is 3 rows up from the last non-empty cell, covering a range of 3 rows and 1 column starting from that cell.

Dynamic Chart Range

If you have a dataset in cells A1:B10 and need a dynamic chart that always displays the last 5 data points, use the OFFSET function to set the chart series range dynamically.

Data Formula
Sheet1!$A$6 =OFFSET(Sheet1!$A$1, COUNTA(Sheet1!$A:$A)-5, 0, 5, 1)
Sheet1!$B$6 =OFFSET(Sheet1!$B$1, COUNTA(Sheet1!$B:$B)-5, 0, 5, 1)

In this case, the OFFSET function updates the chart’s series range, always maintaining a display of the last 5 data points.

This overview demonstrates just a few ways the OFFSET function can be utilized in Excel and Google Sheets to create adaptable and responsive formulas that accommodate data evolution.

More information: https://support.microsoft.com/en-us/office/offset-function-c8de19ae-dd79-4b9b-a14e-b4d906d11b66

Other functions
Returns a reference as text to a single cell in a worksheet
Returns the number of areas in a reference
Chooses a value from a list of values
Returns the column number of a reference
Returns the number of columns in a reference
Filters a range of data based on criteria you define
Returns the formula at the given reference as text
Returns data stored in a PivotTable report
Looks in the top row of an array and returns the value of the indicated cell
Creates a shortcut or jump that opens a document stored on a network server, an intranet, or the Internet
Uses an index to choose a value from a reference or array
Returns a reference indicated by a text value
Looks up values in a vector or array
Looks up values in a reference or array
Returns the row number of a reference
Returns the number of rows in a reference
Retrieves real-time data from a program that supports COM automation
Sorts the contents of a range or array
Sorts the contents of a range or array based on the values in a corresponding range or array
Returns the transpose of an array
Returns a list of unique values in a list or range
Looks in the first column of an array and moves across the row to return the value of a cell
Searches a range or an array, and returns an item corresponding to the first match it finds If a match doesn't exist, then XLOOKUP can return the closest (approximate) match
Returns the relative position of an item in an array or range of cells