OFFSET Function in Excel: How It Works with Examples
In this article
The OFFSET function in Excel returns a reference to a cell or range that sits a specified number of rows and columns away from a starting point. In plain terms, it lets a formula "move" across your sheet dynamically, so the formula can point at different cells as your data changes. Its syntax is =OFFSET(reference, rows, cols, [height], [width]). It works in every modern version of Excel, including Excel for Microsoft 365, Excel 2019, Excel 2016 and Excel for the web.
What You'll Need
- A copy of Excel (desktop or Excel for the web) or another spreadsheet app that supports OFFSET, such as Google Sheets or LibreOffice Calc.
- A worksheet with some sample data, for example months in column A and sales figures in column B.
- Basic familiarity with typing formulas into a cell and pressing Enter.
Step-by-Step
- Understand the syntax. OFFSET takes up to five arguments: =OFFSET(reference, rows, cols, [height], [width]). Reference is the starting cell, rows is how many rows to move down (negative moves up), cols is how many columns to move right (negative moves left), and the optional height and width define how large the returned range should be. If you omit height and width, OFFSET returns a single cell.
- Enter some sample data. In a blank sheet, type Jan, Feb, Mar, Apr into cells A1 to A4 and 100, 200, 300, 400 into B1 to B4.
- Try a basic OFFSET formula. In cell D1, type =OFFSET(A1,2,1) and press Enter. The result is 300, because the formula starts at A1, moves down 2 rows and right 1 column, landing on B3.
- Test negative movement. In D2, type =OFFSET(B4,-3,-1). This starts at B4, moves up 3 rows and left 1 column, returning the text "Jan" from A1.
- Return a range instead of one cell. In D3, type =SUM(OFFSET(B1,0,0,4,1)). Here height is 4 and width is 1, so OFFSET returns B1:B4 and SUM adds it up to 1000.
- Make it dynamic with a helper cell. Put the number 3 in cell F1, then in D4 type =OFFSET(A1,F1,1). The formula now returns 400 (B4) because it moves down 3 rows. Change F1 to 1 and the result updates to 200 automatically. This is the core trick behind dynamic dashboards and rolling averages.
- Combine OFFSET with COUNTA for a growing list. If column B keeps getting new entries, =SUM(B1:OFFSET(B1,COUNTA(B:B)-1,0)) sums from B1 down to the last non-empty cell, no matter how long the list becomes. Note that when OFFSET returns a range for another function like SUM, the two references are joined with a colon as shown.
- Build a rolling average (optional). To average the last 3 values in column B as it grows, use =AVERAGE(OFFSET(B1,COUNTA(B:B)-3,0,3,1)). This finds the last entry, then grabs a 3-cell tall window ending there.
Common Mistakes
- Offsetting past the edge of the sheet. If the movement would land outside the grid (for example =OFFSET(A1,-1,0)), Excel returns a #REF! error.
- Forgetting that OFFSET returns a reference, not a value. On its own, =OFFSET(A1,2,1) displays the value of the target cell, but the real power is using it inside SUM, AVERAGE, INDEX, MATCH and so on.
- Confusing rows and columns. The order is always rows first, then columns. Swapping them silently returns the wrong cell without any error.
- Using OFFSET inside its own reference. A formula like =OFFSET(B1,0,0) placed in B1 creates a circular reference and Excel warns you.
- Overusing OFFSET in huge workbooks. OFFSET is volatile, meaning Excel recalculates it every time anything in the workbook changes, which can slow down very large files. For fixed lookups, INDEX/MATCH or XLOOKUP is faster.
Tips
- Use the optional height and width arguments to grab whole blocks: =SUM(OFFSET(A1,0,0,4,2)) sums a 4-row by 2-column area.
- Pair OFFSET with MATCH to locate a label dynamically: =OFFSET(A1,MATCH("Mar",A:A,0)-1,1) returns the value next to "Mar".
- Keep the offset numbers in helper cells rather than hard-coding them, so you can adjust the formula without editing it.
- On modern Excel, consider INDEX or the newer dynamic array functions (such as TAKE and XLOOKUP) as faster, non-volatile alternatives for many OFFSET use cases.
Troubleshooting
- #REF! error: the offset points off the sheet. Check that rows and cols don't push the reference above row 1 or left of column A, and that height and width fit inside the sheet.
- #VALUE! error: one of the numeric arguments contains text or is blank. Make sure rows, cols, height and width are numbers (or cells containing numbers).
- #NAME? error: you misspelled OFFSET or another function name in the formula. Retype it carefully.
- Wrong value but no error: you likely swapped the rows and cols arguments, or forgot that the starting reference itself counts as zero offset. Reread the formula with a small test dataset.
- Slow workbook: replace large numbers of OFFSET formulas with INDEX-based equivalents, which are not volatile.
- Formula shows as text: the cell is formatted as Text. Change the cell format to General, then re-enter the formula.
Frequently Asked Questions
What does the OFFSET function do in Excel?
It returns a reference to a cell or range positioned a given number of rows and columns away from a starting cell, based on numbers you supply or calculate.
What is the difference between OFFSET and INDEX?
Both can return a shifted reference, but OFFSET moves from a starting point while INDEX picks a position inside a defined range. INDEX is not volatile, so it recalculates faster in big workbooks.
Is OFFSET volatile?
Yes. Excel recalculates every OFFSET formula whenever any cell in the workbook changes, which is why heavy use can slow performance.
Can OFFSET return a whole range?
Yes. Use the optional height and width arguments, for example OFFSET(A1,0,0,5,2) for a 5-row by 2-column range, then wrap it in SUM or AVERAGE.
Does OFFSET work in Google Sheets?
Yes, Google Sheets supports OFFSET with the same syntax and behavior, so formulas transfer directly in most cases.
Why does my OFFSET formula return 0?
The reference probably lands on an empty cell. OFFSET returns 0 for blank cells by default, so check the row and column arguments against your data.