Dynamic 365 solution for SUMIF INDEX MATCH

PrettyGood_Not Great

Board Regular
Joined
Nov 24, 2023
Messages
102
Office Version
  1. 365
Platform
  1. Windows
Hi, I am wondering if there is a go to 365 equation that can spill down or possibly even spill in 2d that can replace an old 2016 staple.

SUMIF(Sheet1!Vertical Criteria Range,Vertical Criteria,INDEX(Sheet1!Sum Range,0,XMATCH(Horizontal Criteria,Sheet1!Horizontal Criteria Range,0))

If more information is required I can provide, however I am looking at this as a general case. I use this equation in many different places.

Thank you
 
Could we have some smallish sample data (with the expected results filled in manually) with XL2BB and explain again in relation to that sample data? That way we can be sure we are working with the layout and type of data you are, rather that guessing. ;)
Hi Peter, here you go.

Cell Formulas
RangeFormula
C2:G11C2=RAND()
J2:N6J2=SUMIF($B$2:$B$11,J$1,INDEX($C$2:$G$11,,MATCH($I2,$C$1:$G$1,0)))
 
Upvote 0

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
That table structure is quite a bit different from the original. Here is one approach, although I'm not sure I'd go to the trouble just to have a 2-dimensional spill.
Book1
ABCDEFGHIJKLMNOPQRSTU
1Source DataData Table3/1/20244/1/20245/1/20246/1/20247/1/2024SUMIF INDEX MATCH SolutionResult Table1025203040365 SoltuionResult Table1025203040
2100.5640.9700.8410.2310.7933/1/20241.0050.2070.7410.6011.1843/1/20241.0050.2070.7410.6011.184
3250.1080.4240.4510.1240.7984/1/20241.0170.6720.7371.1080.8244/1/20241.0170.6720.7371.1080.824
4200.2080.4860.4770.9970.2935/1/20241.8150.8501.2970.4380.7065/1/20241.8150.8501.2970.4380.706
5300.0140.9160.3100.2690.7176/1/20240.6240.5571.5930.5400.5076/1/20240.6240.5571.5930.5400.507
6400.4620.1940.0480.0830.6517/1/20241.0920.9800.8031.5531.0307/1/20241.0920.9800.8031.5531.030
7100.4410.0470.9740.3930.299
8250.0990.2490.3990.4330.183
9200.5330.2510.8210.5960.510
10300.5870.1920.1280.2710.836
11400.7220.6310.6580.4230.379
Sheet1
Cell Formulas
RangeFormula
J2:N6J2=SUMIF($B$2:$B$11,J$1,INDEX($C$2:$G$11,,MATCH($I2,$C$1:$G$1,0)))
Q2:U6Q2=MAKEARRAY(COUNTA(P2:P6),COUNTA(Q1:U1),LAMBDA(r,c,SUMPRODUCT(C2:G11,(B2:B11=INDEX(Q1:U1,,c))*(C1:G1=INDEX(P2:P6,r)))))
Dynamic array formulas.
 
Upvote 0
I have also taken a MAKEARRAY approach (& simplified the sample data to make checking easier :eek:)

24 03 19.xlsm
ABCDEFGHIJKLMNOPQRSTU
1Source DataData TableMar-24Apr-24May-24Jun-24Jul-24SUMIF INDEX MATCH SolutionResult Table1025203040365 SoltuionResult Table1025203040
21091345Mar-2416156184Mar-2416156184
32584618Apr-247911714Apr-247911714
42055591May-241212844May-241212844
53096243Jun-2412814128Jun-2412814128
64025358Jul-241113269Jul-241113269
71076986
82575675
92016351
103091283
114029131
12
PGNG (2)
Cell Formulas
RangeFormula
J2:N6J2=SUMIF($B$2:$B$11,J$1,INDEX($C$2:$G$11,,MATCH($I2,$C$1:$G$1,0)))
Q2:U6Q2=MAKEARRAY(ROWS(P2:P6),COLUMNS(Q1:U1),LAMBDA(r,c,SUM(FILTER(INDEX(C2:G11,0,r),B2:B11=INDEX(Q1:U1,c),0))))
Dynamic array formulas.
 
Upvote 0
I have also taken a MAKEARRAY approach (& simplified the sample data to make checking easier :eek:)

24 03 19.xlsm
ABCDEFGHIJKLMNOPQRSTU
1Source DataData TableMar-24Apr-24May-24Jun-24Jul-24SUMIF INDEX MATCH SolutionResult Table1025203040365 SoltuionResult Table1025203040
21091345Mar-2416156184Mar-2416156184
32584618Apr-247911714Apr-247911714
42055591May-241212844May-241212844
53096243Jun-2412814128Jun-2412814128
64025358Jul-241113269Jul-241113269
71076986
82575675
92016351
103091283
114029131
12
PGNG (2)
Cell Formulas
RangeFormula
J2:N6J2=SUMIF($B$2:$B$11,J$1,INDEX($C$2:$G$11,,MATCH($I2,$C$1:$G$1,0)))
Q2:U6Q2=MAKEARRAY(ROWS(P2:P6),COLUMNS(Q1:U1),LAMBDA(r,c,SUM(FILTER(INDEX(C2:G11,0,r),B2:B11=INDEX(Q1:U1,c),0))))
Dynamic array formulas.
ok interesting. What can be done to prevent spilling in the horizontal. My sheet can spill down, but has multiple data arrays shoulder to shoulder so I can't spill to the right.
 
Upvote 0
If PIVOTBY is available, you can try:
Rich (BB code):
=PIVOTBY(TOCOL(C1:G1+C2:G11*0),TOCOL(B2:B11+C2:G11*0),TOCOL(C2:G11),SUM,,0,,0)
1710860865371.png
 
Upvote 0
ok interesting. What can be done to prevent spilling in the horizontal. My sheet can spill down, but has multiple data arrays shoulder to shoulder so I can't spill to the right.
Not sure why you said this at the beginning then? ;)
that can spill down or possibly even spill in 2d


If you only want to spill down, then try ..

24 03 19.xlsm
BCDEFGOPQRSTU
1Data TableMar-24Apr-24May-24Jun-24Jul-24365 SoltuionResult Table1025203040
21091345Mar-2416156184
32584618Apr-247911714
42055591May-241212844
53096243Jun-2412814128
64025358Jul-241113269
71076986
82575675
92016351
103091283
114029131
PGNG (3)
Cell Formulas
RangeFormula
Q2:U6Q2=BYROW($P2:$P6,LAMBDA(r,SUMIF($B2:$B11,Q1,INDEX($C2:$G11,0,MATCH(r,$C1:$G1,0)))))
Dynamic array formulas.
 
Upvote 0
Solution

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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