sumifs with dynamic suming range

TG2812

Board Regular
Joined
Apr 15, 2015
Messages
192
Hi, I'm trying to come up with a dynamic suming range within sumifs formula.
I'm trying to sum between today and today +12 with several conditions.


How can I get to the below result with a SUMIFS? What I'm struggling with is to come up with a dynamic summing range. Most probably with OFFSET?

Sheet1

Assuming the data starts in A1

[TABLE="width: 500"]
<tbody>[TR]
[TD]Model[/TD]
[TD]Region[/TD]
[TD]Calculation[/TD]
[/TR]
[TR]
[TD]Model 1[/TD]
[TD]Region 1[/TD]
[TD](expected result 140 from sheet 2)[/TD]
[/TR]
</tbody>[/TABLE]

The expected result is the sum between Dec-18 and Nov-19 = 140


Sheet2

Assuming the date starts in A1

[TABLE="width: 500"]
<tbody>[TR]
[TD]Model[/TD]
[TD]Region[/TD]
[TD]Dec-18[/TD]
[TD]Jan-19[/TD]
[TD]Feb-19[/TD]
[TD]Mar-19[/TD]
[TD]Apr-19[/TD]
[TD]May-19[/TD]
[TD]Jun-19[/TD]
[TD]Jul-19[/TD]
[TD]Aug-19[/TD]
[TD]Sept-19[/TD]
[TD]Oct-19[/TD]
[TD]Nov-19[/TD]
[TD]Dec-19[/TD]
[/TR]
[TR]
[TD]Model 1[/TD]
[TD]Region 1[/TD]
[TD]5[/TD]
[TD]3[/TD]
[TD]4[/TD]
[TD]6[/TD]
[TD]9[/TD]
[TD]16[/TD]
[TD]15[/TD]
[TD]20[/TD]
[TD]23[/TD]
[TD]22[/TD]
[TD]9[/TD]
[TD]8[/TD]
[TD]1[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
How about
=SUMIFS(C2:O2,C1:O1,">="&EOMONTH(TODAY(),-1)+1,C1:O1,"<="&EOMONTH(TODAY(),11))
 
Upvote 0
Hi, unfortunately the below formula returns me a #VALUE error:
=SUMIFS(Sheet2!$E$3:$Z$10000,Sheet2!$2:$2,">="&EOMONTH(TODAY(),-1)+1,Sheet2!$2:$2,">="&EOMONTH(TODAY(),11),Sheet2!$A:$A,Sheet1!A1,Sheet2!$B:$B,Sheet1!B1)
 
Upvote 0
How about


Excel 2013/2016
ABCDEFGHIJKLMNO
1ModelRegionDec-18Jan-19Feb-19Mar-19Apr-19May-19Jun-19Jul-19Aug-19Sep-19Oct-19Nov-19Dec-19
2Model 1Region 2534692030202322981
3Model 1Region 1534691615202322981
4
5
6ModelRegionCalculation
7Model 1Region 1140
search
Cell Formulas
RangeFormula
C7{=SUMIFS(INDEX(C2:O3,MATCH(1,(A2:A3=A7)*(B2:B3=B7),0),0),C1:O1,">="&EOMONTH(TODAY(),-1)+1,C1:O1,"<="&EOMONTH(TODAY(),11))}
Press CTRL+SHIFT+ENTER to enter array formulas.


Do not use whole row/column references with this formula.
 
Upvote 0

Book1
ABCDEFGHIJKLMNO
1ModelRegion1-Dec-181-Jan-191-Feb-191-Mar-191-Apr-191-May-191-Jun-191-Jul-191-Aug-191-Sep-191-Oct-191-Nov-191-Dec-19
2Model 1Region 2534692030202322981
3Model 1Region 1534691615202322981
Sheet2



Book1
ABC
11-Dec-18
21-Nov-19
3ModelRegionCalculation
4Model 1Region 1140
5
Sheet1


In c4 control+shift+enter, not just enter:

=SUMIFS(INDEX(Sheet2!$C$2:$O$3,MATCH($A4,IF(Sheet2!$B$2:$B$3=$B4,Sheet2!$A$2:$A$3),0),0),Sheet2!$C$1:$O$1,">="&$A$1,Sheet2!$C$1:$O$1,"<="&$A$2)
 
Upvote 0
Thanks. Do you have a way to do it without array formula? The file I'm working on is already very heavy..
 
Upvote 0
I don't know of any way of doing it without an array formula, but formulae aren't my strong point.
 
Upvote 0
Thanks. Do you have a way to do it without array formula? The file I'm working on is already very heavy..

The following set up allows you to invoke range-processing which faster than an equivalent array processing...


Book1
ABCDEFGHIJKLMNOP
1ModelRegionCONCAT1-Dec-181-Jan-191-Feb-191-Mar-191-Apr-191-May-191-Jun-191-Jul-191-Aug-191-Sep-191-Oct-191-Nov-191-Dec-19
2Model 1Region 2Model 1|Region 2534692030202322981
3Model 1Region 1Model 1|Region 1534691615202322981
Sheet2


In C2 of Sheet2 just enter and copy down while the data is shifted one column to the right...

=A2&"|"&B2



Book1
ABC
11-Dec-18
21-Nov-19
3ModelRegionCalculation
4Model 1Region 1140
5
Sheet1


The formula in C4 becomes:

=SUMIFS(INDEX(Sheet2!$D$2:$P$3,MATCH($A4&"|"&$B4,Sheet2!$C$2:$C$3,0),0),Sheet2!$D$1:$P$1,">="&$A$1,Sheet2!$D$1:$P$1,"<="&$A$2)

which needs just enter.
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

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