Excel - OFFSET Function



OFFSET Function

The Excel OFFSET function is part of the Lookup and Reference function. It dynamically extracts a subset of rows depending on the starting cell reference and the number of rows and columns specified in its arguments.

For example, the OFFSET function helps extract only the sales production of the last quarter, which contains a million datasets. With the assistance of the OFFSET function, you can quickly extract valuable records by adjusting the offsets and cell references without modifying the original dataset.

Compatibility

This advanced Excel function is compatible with the following versions of MS Excel −

  • Excel for Microsoft 365
  • Excel for Microsoft 365 for Mac
  • Excel for the web
  • Excel 2024
  • Excel 2024 for Mac
  • Excel 2021
  • Excel 2021 for Mac
  • Excel 2019
  • Excel 2016
  • Excel 2013
  • Excel 2010
  • Excel 2007

Syntax

The syntax of the OFFSET function is as follows −

=OFFSET(reference, rows, cols, [height], [width])

Arguments

You can use the following arguments with the OFFSET function −

Argument Description Required / Optional
Reference It specifies the cell reference or range as a starting point for employing the OFFSET function. Required
Rows

It indicates the number of rows upward or downward in a worksheet. Its value can be negative(above the Reference argument) or positive(below the Reference argument).

For example, setting the Rows argument to 3 indicates that the upper-left cell in the reference is three rows below it.

Required
Cols

It specifies the number of columns from the left to right.

E.g., Setting 2 as the Cols argument indicates that the upper left cell in the reference is five columns of the reference's right.

This argument can be positive (to the right of the cell reference specified) or negative (to the left of the cell reference).

Required
Height

The height is expressed in rows of the returned reference.

The Height argument must contain a non-negative number.

Optional
Width

The Width, expressed in columns, of the returned reference.

The Width argument must contain a nonnegative number.

Optional

Points to Remember

  • If any of the arguments contain a non-numeric value, then the OFFSET function will retrieve the #VALUE! error.
  • You may merge the OFFSET function with other functions like SUM, AVERAGE etc.
  • If the OFFSET function does not specify the height or width argument. Then, the same height or width would be considered.
  • Only reference will be retrieved by the OFFSET function; this function does not alter or move cells in a worksheet.
  • The OFFSET function returns the #REF! error if the rows and cols offset reference crosses the worksheet's edge.

Examples of OFFSET Function in Excel

Practice the following examples to learn the use of the OFFSET function in Excel.

Example 1: What does the OFFSET Function do in Excel?

In this example, the subset of rows is to be extracted within the cell range by setting the offsets and cell references supplied in the arguments of the OFFSET function.

Solution

Step 1 − First, assume the sample dataset where the numeric values are specified in the cell range B2:C6.

OFFSET Function do in Excel1

Step 2 − After that, enter the formula =OFFSET(H1,3,-7,3,2) in the F3 cell.

OFFSET Function do in Excel2

Explanation

=OFFSET(H1,3,-7,3,2)
  • The Reference argument specifies the cell reference to base the offset.
  • The Rows argument is 3, which means the result range is to be fetched from the third row.
  • The Cols argument is -7, starting from the right to the left from the H1 cell reference and shifting to the A column.
  • The height argument is 3, meaning three rows' values to be fetched.
  • The width argument is 2, meaning the resulting values will be extracted from the A and B columns.
OFFSET Function do in Excel3

Example 2: Combining the SUM Function with the OFFSET Function in Excel

In this example, we will compute the sum of the values by combining the SUM with the OFFSET function.

Solution

First, you may enter the formula =SUM(OFFSET(A1,2,2,7,2)) in the E5 cell and hit the Enter tab. In this expression, the starting point is A1. The number of rows is two, which means values are to be fetched after the second row. The number of columns is 2, which means that after the second column, C column values are to be selected. The height and width arguments are set to 7 and 2 that means seven row's data are to be added of the Array2.

Combining SUM Function with OFFSET Function

After that, press the Enter tab to obtain the summation of values in the array2.

Combining SUM Function with OFFSET Function2

Download Practice Sheet

You can download and use the sample data sheet to practice the OFFSET function.

Advertisements