Excel users often face the phenomenon of performing calculations on cells having a relative distance from other cells. In these situation, the OFFSET function comes in very handy. It returns a cell or range or cells that are a specified number of rows and columns away from a cell or range of cells. In this tutorial, we will learn how to use the offset function in Excel.
Figure 1. Example of How to Use the Excel Offset Function
Syntax
=OFFSET (reference, rows, cols, [height], [width])
Arguments
- reference – This argument is required. It is a cell reference or range representing the starting point.
- rows – This argument is also required. It is the rows to offset below the starting reference.
- cols – This is a required argument as well. It represents the columns we want to offset right of the starting reference.
- height – This argument is optional. It is the height counted in rows of the reference that is returned.
- width – This argument is also optional. It represents the width calculated in columns of the reference returned.
How the Formula Works
The OFFSET function in Excel returns a reference to a cell or range of cells offset from a starting point. This starting point can be a cell or a range of cells. The offset is supplied as rows or columns having a specified distance from the starting point. We can also provide the height and width arguments. They find the size of the reference which is created.
We can use OFFSET to create a dynamic named range for charts or pivot tables. This makes sure source data is always updated.
Setting up Data
The following example uses a fruit sales database for the last quarter of 2018. Column A has the names, column B to D has the sales.
Figure 2. The Sample Data
To find out the total sales information on oranges, we need to
- Go to cell G4. Select it with our mouse.
- Go to the formula bar of G4 and assign the formula
=SUM(OFFSET(A1,3,1,1,3))
. - Press Enter.
Figure 3. Applying the Formula
This will show the total sales of oranges in cell G4.
Notes
- The OFFSET function returns a reference only, it does not move any cells.
- We can provide negative row and column numbers. It can reverse the normal offset direction of the row or columns. Negative columns offset to the left. Negative rows offset on the top.
- OFFSET 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.
Most of the time, the problem you will need to solve will be more complex than a simple application of a formula or function. If you want to save hours of research and frustration, try our live Excelchat service! Our Excel Experts are available 24/7 to answer any Excel question you may have. We guarantee a connection within 30 seconds and a customized solution within 20 minutes.
Leave a Comment