Sumproduct with Arrays of Different sizes

YuanChen0824

New Member
Joined
Mar 10, 2023
Messages
14
Office Version
  1. 365
Platform
  1. Windows
Hello, guys, I want some help with my excel functions
(Sorry I don't speak English so my post will likely be a challenge to read)
Here's the sheet (sheet 2) :
1678430461205.png


the function(on the Left):
3/10/20233/11/20233/12/20233/13/20233/14/20233/15/2023
ABC=SUMPRODUCT((B$2=Sheet1!$C$2:$C$7)*(Sheet2!$A3=Sheet1!$B$2:$B$7)*(Sheet1!$D$2:$D$7))=SUMPRODUCT((C$2=Sheet1!$C$2:$C$7)*(Sheet2!$A3=Sheet1!$B$2:$B$7)*(Sheet1!$D$2:$D$7))=SUMPRODUCT((D$2=Sheet1!$C$2:$C$7)*(Sheet2!$A3=Sheet1!$B$2:$B$7)*(Sheet1!$D$2:$D$7))=SUMPRODUCT((E$2=Sheet1!$C$2:$C$7)*(Sheet2!$A3=Sheet1!$B$2:$B$7)*(Sheet1!$D$2:$D$7))=SUMPRODUCT((F$2=Sheet1!$C$2:$C$7)*(Sheet2!$A3=Sheet1!$B$2:$B$7)*(Sheet1!$D$2:$D$7))=SUMPRODUCT((G$2=Sheet1!$C$2:$C$7)*(Sheet2!$A3=Sheet1!$B$2:$B$7)*(Sheet1!$D$2:$D$7))
The other sheet I want to reference to (The sheet 1) :
1678430595699.png



I want my function return the corresponding value (which works fine)
But my current function can't be used when I want it check a group of names(ABC & DEF, but not ZZZ)

Please help? I've Try so many ways, I've read so many post, but none of them can help me...
 

Attachments

  • 1678430654992.png
    1678430654992.png
    4.8 KB · Views: 9

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Hi, see the linked file for a possible solution...

The formula used in the table:
=SUMPRODUCT((B$2=Sheet1!$C$2:$C$7)*(Sheet1!$D$2:$D$7)*(IFERROR(MATCH((Sheet1!$B$2:$B$7),$I4:$I5,0),0)>0))

Arrays.xlsx

Arrays.png
 
Upvote 1
Solution
Something like this:

mr excel questions 13.xlsm
ABCD
1NAMETIMENUMB
2ABC2023-03-1026
3ABC2023-03-1132
4ABC2023-03-1248
5DEF2023-03-1344
6DEF2023-03-10128
7ZZZ2023-03-1598
8
9ALL2023-03-10
10ABC10626
11DEF172128
12ABC & DEF278154
Sheet13
Cell Formulas
RangeFormula
C10C10=SUMPRODUCT(--($B$2:$B$7=$B10)*$D$2:$D$7)
D10:D11D10=SUMPRODUCT(--($B$2:$B$7=$B10)*(--(D$9=$C$2:$C$7))*$D$2:$D$7)
C11C11=SUMPRODUCT(--($B$2:$B$7=B11)*$D$2:$D$7)
C12C12=SUMPRODUCT(((--($B$2:$B$7=$B11))+(--($B$2:$B$7=$B10)))*$D$2:$D$7)
D12D12=SUMPRODUCT(((--($B$2:$B$7=$B11))+(--($B$2:$B$7=$B10)))*(--(D$9=$C$2:$C$7))*$D$2:$D$7)
 
Upvote 1
But my current function can't be used when I want it check a group of names(ABC & DEF, but not ZZZ)
What would your results look like if you were doing this with the original sample data above?
 
Upvote 1
Hi, I am very glad that the formula works.
If I have enough knowledge, I am happy to help at any time.
 
Upvote 1
I see that you already have a solution, but since you have version 365 you could also employ one of the new functions there (FILTER) rather than the older SUMPRODUCT.

YuanChen0824.xlsx
BCD
1NAMETIMENUM
2ABC10/03/202326
3ZZZ11/03/202332
4ABC12/03/202348
5VWX13/03/202344
6DEF14/03/2023128
7ZZZ15/03/202398
8JKL12/03/2023200
9
Sheet1


YuanChen0824.xlsx
ABCDEFG
210/03/202311/03/202312/03/202313/03/202314/03/202315/03/2023
3GROUP260248441280
4ABC
5DEF
6GHI
7JKL
8MNO
9PQR
10STU
11VWX
12
Sheet2
Cell Formulas
RangeFormula
B3:G3B3=SUM(FILTER(Sheet1!$D$2:$D$8,(Sheet1!$C$2:$C$8=B$2)*(IFNA(MATCH(Sheet1!$B$2:$B$8,$A$4:$A$11,0),0)),0))
 
Upvote 1
Does the new "Filter" function has better performance?
Because I'm dealing with some BIG data.
It may not be that good on very large data, but then neither will SUMPRODUCT.
SUMIFS is pretty efficient, so you may possibly find better performance with a structure like below, even though it involves a lot more formulas.
Each case is different and I have not tested any of these suggestions on large data, but at least you have some options to test. :)
I guess that another option might be vba if these all prove too slow.

YuanChen0824.xlsx
ABCDEFG
210/03/202311/03/202312/03/202313/03/202314/03/202315/03/2023
3GROUP260248441280
4ABC26048000
5DEF00001280
6GHI000000
7JKL00200000
8MNO000000
9PQR000000
10STU000000
11VWX0004400
Sheet3
Cell Formulas
RangeFormula
B3:G3B3=SUM(B4:B11)
B4:G11B4=SUMIFS(Sheet1!$D$2:$D$8,Sheet1!$C$2:$C$8,B$2,Sheet1!$B$2:$B$8,$A4)
 
Upvote 1
Hi, I created the newer version of the table for your #13 message.

The new formula used in the new table:
=LET(i,IFERROR(MATCH($A2,Groups!$1:$1,0),0),c,CHAR(64+IFERROR(MATCH($A2,Groups!$1:$1,0),0)),n,(Data!$C$2:$C$11),t,(C$1=Data!$A$2:$A$11),IF(i=0,SUMPRODUCT(t*($A2=Data!$B$2:$B$11)*n),SUMPRODUCT(t*n*(IFERROR(MATCH((Data!$B$2:$B$11),INDIRECT("Groups!$"&c&":$"&c),0),0)>0))))

ArraysNewer.xlsx

ArraysNewer.png
 
Upvote 1
OMG!!!!!!
Thank You guys soo much! (Also sorry for not responding for days, I was busy)
I'll go and try everything y'all offer me.
Will reply soon
 
Upvote 0

Forum statistics

Threads
1,215,161
Messages
6,123,377
Members
449,097
Latest member
Jabe

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