You asked for it
. Here's an explanation from scratch:
When you need to identify a moving target in excel (a range that changes, for example), OFFSET is one of the best options. It has a handful of arguments/components:
OFFSET (reference, rows, columns, height, width)
reference - the starting point
rows - how many rows down or up from the starting point is the first cell in the range?
columns - how many columns right or left from the starting point is the first cell in the range?
height - what is the height dimension of the range
width - what is the width dimension of the range
So, in your formula, the OFFSET function works like this:
OFFSET ($A$27, 1, ROW($A2)-1, 15, width)
reference $A$27 - this identifies cell A28 as the fixed starting point for identifying the moving target
row 1 - the moving target is a range that always begins
1 row below the reference point
$A$27
column ROW($A2)-1 - the column of the target range changes on each row.
That is to say, for the first row of the summary table, our target range is data from the first column of our detailed table. For the second row of the summary table, our target range is data from the second column of the detailed table.
Consequently, we have to use a relative formula to calculate how many columns to the right of the reference point $A$27 is the target range?
The ROW($A2)-1 formula says "The number of columns to the right is calculated by checking which row of the spreadsheet I'm in, and subtracting 1"
(If I'm in row 2 of the worksheet, the target range is 1 row to the right of the reference point. If I'm in row 3 of the worksheet, the target range is 2 rows to the right of the reference point...etc.)
height 15 - the moving target is a range that is always 15 rows tall
width 1 - the moving target is a range that is always 1 column wide
SO. As you suggested: If. you. want. to. move. your. table.
You will have to ask yourself: How can I modify the ROW($A2)-1 argument based on the table's new location and dimensions to calculate the number of columns to the right of the reference point $A$27 where the OFFSET formula will find the target range?
Ummm. If you're still reading, you might need something better to do with your time...
All best.