Forum Discussion
Range changing in increments
- Jul 17, 2021
Let's say the formula =SUM(DataSheet!B2:B138) is in cell D2 of the summary sheet.
Change it to
=SUM(OFFSET(DataSheet!$B$2:$B$138, 137*(ROW()-2), 0))
or
=SUM(INDEX(DataSheet!B:B,137*(ROW()-2)+2):INDEX(DataSheet!B:B,137*(ROW()-2)+138))
Then fill down.
Let's say the formula =SUM(DataSheet!B2:B138) is in cell D2 of the summary sheet.
Change it to
=SUM(OFFSET(DataSheet!$B$2:$B$138, 137*(ROW()-2), 0))
or
=SUM(INDEX(DataSheet!B:B,137*(ROW()-2)+2):INDEX(DataSheet!B:B,137*(ROW()-2)+138))
Then fill down.
- Tbear_beardsleyJul 17, 2021Copper ContributorPerfect. Can you explain the row situation. And would it be similar if I wanted to do the same along the columns for data going across?
- Tbear_beardsleyJul 17, 2021Copper ContributorNever mind found out I just have to take the $ off the B but leave it on the number
- HansVogelaarJul 17, 2021MVP
Great!
ROW() returns the row number of the cell with the formula. So for a cell in row 2, ROW() returns 2.
ROW()-2 returns 0 in row 2, 1 in row 3 etc.
137*(ROW()-2) returns 0 in row 2, 137 in row 3, etc.
OFFSET(DataSheet!B$2:B$138, 137*(ROW()-2), 0) is equivalent to B$2:B$138 in row 2, but to B$139:B$275 (that is, 137 rows down from B$2:B$137) in row 3, etc.