SUM OFFSET help?

Bravo2003

Active Member
Joined
Apr 1, 2010
Messages
278
Office Version
  1. 365
Platform
  1. Windows
Hi All,
I've not used OFFSET before so am struggling to work out what I need to do with this requirement:

I have a sheet with sets of 6 cells that need to be summed up.

example:
SHEET1 - has COLUMN N - ROWS 8-13 with numbers in
then another 6 rows from 15-20, 22-27, etc...
Then this repeats in every 9th Column (so in X, AH, AR, etc..)

In SHEET2 I need:
I5 to sum the first set of 6 cells - N8:N13
J5 to sum the next 6 cells under that - N15-N20
and so on

Whilst in Row 6 it needs to sum the 6 cells 9 columns along
so I6 sums X8:X13
and repeat down and across

Any clues on how to do this without writing 100's of different SUM formula in each cell required?
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Right, I've managed to work out how to sum the different N column requirements

=SUM(OFFSET('SHEET2'!$N$8,0+I$1,0,6,1)) - row1 from I is 0+7 auto populated along

now I nee to get the column reference to move over 9 columns each row?
 
Last edited:
Upvote 0
Whilst in Row 6 it needs to sum the 6 cells 9 columns along
so I6 sums X8:X13
There is a little confusion there, as 9 columns along from column N is column W, not column X.
I am assuming that you want 10 columns along (column X)

In cell I5 of Sheet2, try this formula and copy across and down. You will first need to adjust the two large ranges in the formula (marked blue below) to match your range in Sheet1

=SUM(INDEX(Sheet1!$N$8:$DI$56,COLUMNS($I5:I5)*7-6,ROWS(I$5:I5)*10-9):INDEX(Sheet1!$N$8:$DI$56,COLUMNS($I5:I5)*7-1,ROWS(I$5:I5)*10-9))

Note: I have avoided the OFFSET function as it is a volatile function so could possibly impact the performance of your sheet.
 
Last edited:
Upvote 0
now I nee to get the column reference to move over 9 columns each row?
The secret is to make use of the COLUMN() function, which returns the column number that the formula is placed in.

So, if your first formula is in I5 (column 9), the second is in J5 (column 10), ...
Then the offset from the original N8 would be:
(COLUMN()-9)*9


EDIT: I got distracted while typing this up and missed Peter's response
 
Last edited:
Upvote 0
There is a little confusion there, as 9 columns along from column N is column W, not column X.
I am assuming that you want 10 columns along (column X)

In cell I5 of Sheet2, try this formula and copy across and down. You will first need to adjust the two large ranges in the formula (marked blue below) to match your range in Sheet1

=SUM(INDEX(Sheet1!$N$8:$DI$56,COLUMNS($I5:I5)*7-6,ROWS(I$5:I5)*10-9):INDEX(Sheet1!$N$8:$DI$56,COLUMNS($I5:I5)*7-1,ROWS(I$5:I5)*10-9))

Note: I have avoided the OFFSET function as it is a volatile function so could possibly impact the performance of your sheet.

Thanks, that works, but as Sheet1 will be an expanding file, it might not be the best solution needing to change the range references every time ?

But you are right bout 10 columns not 9... this is my error, and I have now resolved the OFFSET formula to work

=IF($C6<>"",SUM(OFFSET('Sheet1'!$N$8,0+H$1,0+$A6,6,1)),"")
 
Upvote 0
Thanks, that works, but as Sheet1 will be an expanding file, it might not be the best solution needing to change the range references every time ?
Just make the range big enough so you never have to change it?
 
Upvote 0
Just make the range big enough so you never have to change it?


That's an option.. I might now the max row count the sheet will grow to soon, so could adjust it then

On a similar need, can I use this with COUNTIF?
so SheetX B4 need to =COUNTIF(Sheet1!N:N,5)
then in B5 COUNTIF the 10 columns along (X:X), etc..
 
Upvote 0
so SheetX B4 need to =COUNTIF(Sheet1!N:N,5)
You now want to check the whole of column N, not just a block of 6 cells again?

If it is not the small block of cells, can we at least put some sort of cap on the rows being checked so we don't have to check all 1 million+ rows?
 
Last edited:
Upvote 0
You now want to check the whole of column N, not just a block of 6 cells again?

If it is not the small block of cells, can we at least put some sort of cap on the rows being checked so we don't have to check all 1 million+ rows?

I have worked out I would probably only use probably 365-500 rows max - so that should help to start with as N1:N365
 
Upvote 0
So in B4, copied down, try

=COUNTIF(INDEX(Sheet1!N$1:DI$1,ROWS(B$4:B4)*10-9):INDEX(Sheet1!N$1:DI$500,300,ROWS(B$4:B4)*10-9),5)
 
Upvote 0

Forum statistics

Threads
1,214,591
Messages
6,120,426
Members
448,961
Latest member
nzskater

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top