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: 20

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
are you saying that you have many values that you want to include in the "OR" statement?
Please post some examples of the workbook where you input all the possible values you want in the OR statement.
 
Upvote 0
are you saying that you have many values that you want to include in the "OR" statement?
Please post some examples of the workbook where you input all the possible values you want in the OR statement.
Unfortunately I can't do that, my workplace has some strict policy prohibiting me to upload any data, document or picture
But I can show you some example:


1678674401148.png
 
Upvote 0
are you saying that you have many values that you want to include in the "OR" statement?
Please post some examples of the workbook where you input all the possible values you want in the OR statement.
I'm very grateful of your generous help,
I have the solution already, but if you want to discuss this furthermore, I'm with you.
 
Upvote 0
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
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))
Oh cool! I'll definitely give it a try
Does the new "Filter" function has better performance?
Because I'm dealing with some BIG data.
 
Upvote 0
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
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.
Thank You, this is really helpful.
I'm leaning VBA code, too. Maybe I'll try doing that.
If I have some new problem while coding (which I will, for sure)
I'll let you guys know, because this community is just so awesome.
 
Upvote 0

Forum statistics

Threads
1,223,728
Messages
6,174,150
Members
452,548
Latest member
Enice Anaelle

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