Excel OFFSET Function: Build Dynamic Ranges Step by Step
In this article
The OFFSET function returns a reference to a range that is a set number of rows and columns away from a starting point, and it can be made any height and width you choose. That makes it the classic way to build dynamic ranges that grow or shrink with your data, as opposed to fixed references like A1:A10. To use it, type =OFFSET(reference, rows, cols, [height], [width]) into a cell, press Enter, and Excel returns either the value at that shifted position or, when the optional height and width arguments are supplied, a whole block of cells you can feed into another function such as SUM, AVERAGE or COUNTA. OFFSET is a volatile function, so it recalculates every time anything changes in the workbook; that is fine for most worksheets but worth knowing before you scatter it across thousands of rows.
What You'll Need
- A desktop copy of Excel (Microsoft 365, Excel 2021, 2019 or 2016). LOOKUP and INDEX handle the same jobs and are much faster; OFFSET is the right tool when you specifically need a movable reference.
- A worksheet with data laid out in a predictable block, ideally with a clear starting cell to anchor the offset.
- A basic grasp of cell references, including the difference between absolute ($A$1) and relative (A1) references.
Step-by-Step
- Understand the arguments. OFFSET takes five arguments:
reference(the starting cell or range),rows(how many rows to move down, negative to move up),cols(how many columns to move right, negative to move left),height(optional, how many rows the returned range should span) andwidth(optional, how many columns the returned range should span). If you omit height and width, OFFSET returns a single cell. - Pick an anchor cell. Choose the cell from which all movement is measured, usually the top-left cell of your data block. Make the anchor absolute by selecting it in the formula bar and pressing F4 so it reads
$A$1, row references such as$A$1will not shift when you copy the formula down. - Write a simple single-cell offset. In an empty cell, type
=OFFSET($A$1,2,1)and press Enter. This returns whatever sits two rows below and one column to the right of A1, which is cell B3. Change the 2 and 1 to see the result move; this is the fastest way to confirm you understand the direction of travel. - Add height and width to return a range. Type
=OFFSET($A$1,0,0,5,1). Starting at A1, it moves zero rows and zero columns, then returns a block five rows tall and one column wide: A1:A5. On its own Excel displays a #VALUE! error in older versions because a range cannot be shown in one cell; wrap it in a function such as=SUM(OFFSET($A$1,0,0,5,1))to total A1:A5. - Make the height dynamic with COUNTA. Replace the fixed 5 with a count of your column:
=SUM(OFFSET($A$1,0,0,COUNTA($A:$A),1)). When you add rows to column A, the range grows automatically and the total still covers everything. If you have a header row, useCOUNTA($A:$A)-1so the header is not counted. - Move the anchor with MATCH for lookup-style work. Combine OFFSET with MATCH to find a row by label:
=OFFSET($B$1,MATCH("March",$A$2:$A$13,0),0). MATCH returns the position of "March" within A2:A13, and OFFSET uses that number as its row offset from B1. The result is the value in column B for March, without hard-coding a row number. - Use negative offsets. To look backwards, supply negative numbers:
=OFFSET($A$10,-4,0)returns the cell four rows above A10, which is A6. A negative column offset moves left. Attempting to move beyond the edge of the sheet returns a #REF! error. - Combine with named ranges for readability. Select the anchor cell, open the Name Box to the left of the formula bar, type a name such as
Anchorand press Enter. You can then write=SUM(OFFSET(Anchor,0,0,COUNTA($A:$A),1)), which is easier to audit than a formula full of dollar signs. - Test the edges. Add a row of data and confirm the dynamic total updates. Delete the last row and confirm it shrinks. Then deliberately set the height to a number beyond your data and check whether blank-but-empty cells are being counted (they will count if they contain formulas or spaces, which is a common source of wrong totals).
- Copy and fill carefully. Because the anchor is absolute but the height and width arguments are often relative, drag-filling the formula can change the wrong number. Decide which arguments must stay fixed and lock them with F4 before you fill across or down.
Common Mistakes
- Forgetting that offset numbers are zero-based in direction, not position.
OFFSET(A1,0,0)points at A1 itself, not A2. A row offset of 1 means one row down, not the first row. - Mixing up rows and cols order. The third argument is columns and the second is rows; reversing them silently returns the wrong cell with no error.
- Using OFFSET where a table would do. Excel Tables already expand automatically. If your only goal is a growing range, converting the data to a table and referencing it is simpler and less error-prone.
- Ignoring volatility. Every OFFSET recalculates on any change to the workbook. A few dozen are harmless; thousands can make a large sheet sluggish when someone edits an unrelated cell.
- Counting blanks with COUNTA. Cells holding empty strings from formulas, or stray spaces, inflate the count and stretch the range too far.
- Hard-coding a positive offset that runs off the grid. Writing
=OFFSET($A$10,-20,0)near the top of the sheet produces #REF!, because Excel cannot reference a row above row 1.
Tips
- Use the Evaluate Formula tool on the Formulas tab to step through an OFFSET one argument at a time; it is the clearest way to see what the reference actually points to.
- Wrap OFFSET in IFERROR when it might run past your data, for example
=IFERROR(SUM(OFFSET(...)),""), so a #REF! error does not break dashboards. - For lookup tasks, INDEX with MATCH is non-volatile and usually faster; use OFFSET when you need a genuine moving block of cells rather than a single value.
- Pair OFFSET with your own named ranges in formulas people other than you will maintain; the names carry a lot of the readability.
- Keep the anchor cell in a dedicated, labelled spot rather than buried inside the data so it survives sorting and filtering.
Troubleshooting
#REF! error. The offset points outside the worksheet. Check the rows and cols numbers: a negative row offset from a cell near row 1, or a negative column from column A, will fail. Move the anchor down or reduce the numbers.
#VALUE! error. You are returning a multi-cell range but the surrounding formula or cell cannot display a range. Wrap the reference in a function that accepts ranges, such as SUM, AVERAGE or COUNTA, or use a dynamic array version of Excel and confirm you are spilling into empty cells.
Wrong total that changes when you add rows. The COUNTA that sets the height is probably counting blanks, header text or empty strings. Point it at a single column you know is fully populated and subtract 1 for the header if needed.
Formula returns 0 instead of the value you expect. OFFSET often points at an empty cell, and summing empty cells returns zero. Use Evaluate Formula to confirm the returned reference, and check whether you meant a different column offset.
Workbook feels slow. Reduce the number of OFFSET calls, or replace them with INDEX or structured table references. Consider switching calculation to manual while you do heavy editing, then recalculating.
Frequently Asked Questions
What is the difference between OFFSET and INDEX?
Both return a reference, but INDEX is non-volatile and recalculates only when its inputs change, whereas OFFSET recalculates on every workbook change. INDEX is generally preferable for performance and for single-value lookups.
Can OFFSET return a whole row or column?
Yes, if the height or width spans enough cells. For a full column starting at A1, use =SUM(OFFSET($A$1,0,0,ROWS($A:$A),1)). Avoid making several of these in a large file.
Why does OFFSET show #VALUE! when used alone?
A single cell cannot hold a multi-cell range. OFFSET works best inside another function that accepts ranges, such as SUM or AVERAGE.
Does OFFSET work with Excel Tables?
It can, but table structured references already expand automatically, so OFFSET is usually unnecessary. Mixing the two makes formulas harder to read and maintain.
Can I make a chart range dynamic with OFFSET?
Yes, this is a common use: define a named range built on OFFSET and point the chart's series at the name. Because OFFSET is volatile, the chart updates as data is added, though very large workbooks may recalculate more slowly.
Is OFFSET available on Excel for Mac and Excel for the web?
Yes, it is a standard function available across desktop Excel on Windows and Mac and in Excel for the web. Menu labels for name management and evaluation can differ slightly by version, device and region.