0
0
Excelspreadsheet~10 mins

OFFSET for dynamic ranges in Excel - Cell-by-Cell Formula Trace

Choose your learning style9 modes available
Sample Data

Sales data for different fruits in column B. Cell D2 contains the number of items to include dynamically.

CellValue
A1Item
B1Sales
A2Apples
B250
A3Bananas
B330
A4Cherries
B420
A5Dates
B540
A6Elderberries
B610
D1Count
D24
Formula Trace
=SUM(OFFSET(B2,0,0,D2,1))
Step 1: OFFSET(B2, 0, 0, D2, 1)
Step 2: SUM(B2:B5)
Step 3: Final result
Cell Reference Map
    A       B       C       D
1 | Item  | Sales |       | Count
2 | Apples|  50   |       |  4  
3 | Bananas| 30   |       |     
4 | Cherries|20   |       |     
5 | Dates |  40   |       |     
6 | Elderberries|10|       |     

OFFSET starts at B2 and uses D2 for height.
The formula uses cell B2 as the starting point and cell D2 to determine how many rows to include in the range.
Result
    A       B       C       D
1 | Item  | Sales |       | Count
2 | Apples|  50   |       |  4  
3 | Bananas| 30   |       |     
4 | Cherries|20   |       |     
5 | Dates |  40   |       |     
6 | Elderberries|10|       |     

Result in any cell with formula: 140
The formula sums the first 4 sales values (50+30+20+40) and returns 140.
Sheet Trace Quiz - 3 Questions
Test your understanding
What does the OFFSET function return in this formula?
AA range from B2 down 4 rows and 1 column wide
BA single cell B2
CA range from B2 to B6
DA range from A2 to A5
Key Result
OFFSET(start_cell, rows, cols, height, width) returns a dynamic range starting at start_cell offset by rows and cols, with given height and width.