Create and sum a variable range more efficiently than OFFSET

mountainman88

Board Regular
Joined
Jun 22, 2019
Messages
109
Office Version
  1. 2016
Platform
  1. Windows
I have a file that is summing a YTD value by returning a range based on the month. The data for all 12 months exists in the same tab and an OFFSET function linked to the current month number eg 6 for June, sums and returns a range of 6 cells. This is currently performed on every single line of a P+L on many, many tabs.

I know OFFSET is volatile, what alternatives are there to perform the above less processor intensively.

thanks
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
It depends on your layout. Based on your description, SUMIFS, SUM(INDEX:INDEX), or SUMPRODUCT could all work. If you could show a sanitized example of your sheet, showing the existing formulas, we can give you some options.
 
Upvote 0
Column L contains the offset I want to replace with something more efficient. Period_No is a single named range containing the month number. In this instance it is 11 so totalling YTD November.

The P&L is many rows, there are many P&Ls and 5 12-month tables on each tab.

NOV.xlsx
BLBXBYBZCACBCCCDCECFCGCHCI
3YTDJanFebMarAprMayJun Jul AugSepOctNovDec
4ActActActActActActAct Act ActActActActFC
5
6
7
8Total1174.05104.94104.97103.97106.28105.59105.87108.86107.97108.79109.82107.00107.74
9
10A83.017.147.277.978.157.517.056.427.247.737.858.687.25
11B15.751.191.221.541.481.471.511.551.631.421.411.341.67
12C5.190.520.440.500.490.460.470.500.480.470.480.400.40
13D54.064.624.475.035.114.814.503.884.815.485.415.946.21
NA (2)
 
Upvote 0
Hi Mountainman88,

I was already working on an example so this is a slightly different format but it demonstrates SUMPRODUCT, INDIRECT and SUMIFS options. All recalculated in 7 to 8 seconds on 100,000 rows of data with SUMPRODUCT seeming the fastest.

Mountainman88-2.xlsx
ABCDEFGHIJKLMN
1Month
26
301-Jan-2101-Feb-2101-Mar-2101-Apr-2101-May-2101-Jun-2101-Jul-2101-Aug-2101-Sep-2101-Oct-2101-Nov-2101-Dec-21
4SUMPRODUCT231112233445566778899111222333
5INDIRECT231112233445566778899111222333
6SUMIFS231112233445566778899111222333
Sheet1
Cell Formulas
RangeFormula
D3:N3D3=EOMONTH(C3,0)+1
B4B4=SUMPRODUCT(($C4:$N4*($C$3:$N$3<=(DATE(YEAR($C$3),$B$2,1)))))
B5B5=SUM(INDIRECT(ADDRESS(ROW(),COLUMN($C$3))&":"&ADDRESS(ROW(),COLUMN($C$3)+$B$2-1)))
B6B6=SUMIFS($C6:$N6,$C$3:$N$3,"<="&EOMONTH($C$3,-1+$B$2))
 
Upvote 0
Hi Mountainman88,

I was already working on an example so this is a slightly different format but it demonstrates SUMPRODUCT, INDIRECT and SUMIFS options. All recalculated in 7 to 8 seconds on 100,000 rows of data with SUMPRODUCT seeming the fastest.

Mountainman88-2.xlsx
ABCDEFGHIJKLMN
1Month
26
301-Jan-2101-Feb-2101-Mar-2101-Apr-2101-May-2101-Jun-2101-Jul-2101-Aug-2101-Sep-2101-Oct-2101-Nov-2101-Dec-21
4SUMPRODUCT231112233445566778899111222333
5INDIRECT231112233445566778899111222333
6SUMIFS231112233445566778899111222333
Sheet1
Cell Formulas
RangeFormula
D3:N3D3=EOMONTH(C3,0)+1
B4B4=SUMPRODUCT(($C4:$N4*($C$3:$N$3<=(DATE(YEAR($C$3),$B$2,1)))))
B5B5=SUM(INDIRECT(ADDRESS(ROW(),COLUMN($C$3))&":"&ADDRESS(ROW(),COLUMN($C$3)+$B$2-1)))
B6B6=SUMIFS($C6:$N6,$C$3:$N$3,"<="&EOMONTH($C$3,-1+$B$2))
Thanks I know all these methods but are any of these proven to be less processor intensive than OFFSET as it’s currently used?

There are 100 lines in each p&l, 5 sets of 12-month tables per p&l across around 85 tabs. I know for sure INDIRECT won’t cut it, I’m guessing the same for SUMPRODUCT and SUMIFS.
 
Upvote 0
You could try:

Excel Formula:
=SUM($BX8:INDEX($BX8:$CI8,Period_No-1))

INDEX is non-volatile.
 
Upvote 0
Solution
You could try:

Excel Formula:
=SUM($BX8:INDEX($BX8:$CI8,Period_No-1))

INDEX is non-volatile.
I think this is what I’m looking for. I didn’t know you can just use index like that without an indirect. Thanks!
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,911
Messages
6,122,192
Members
449,072
Latest member
DW Draft

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