sum with multiple conditions

aarti_rto

New Member
Joined
Nov 29, 2019
Messages
49
Office Version
  1. 2016
Platform
  1. Windows
  2. Web
Hello Experts.

i have below data..

Date
01-01-2024​
01-01-2024​
01-01-2024​
01-01-2024​
01-01-2024​
01-01-2024​
03-01-2024​
03-01-2024​
05-01-2024​
05-01-2024​
06-01-2024​
06-01-2024​
07-01-2024​
07-01-2024​
08-01-2024​
08-01-2024​
09-01-2024​
09-01-2024​
10-01-2024​
10-01-2024​
11-01-2024​
11-01-2024​
12-01-2024​
Part NumberOpeningReceiptPhy issueSAP issueClosingDiffPhy issueSAP issuePhy issueSAP issuePhy issueSAP issuePhy issueSAP issuePhy issueSAP issuePhy issueSAP issuePhy issueSAP issuePhy issueSAP issuePhy issue
A
100​
958​
182​
674​
609​
459​
996​
889​
697​
521​
323​
234​
363​
608​
805​
743​
429​
809​
417​
223​
B
100​
925​
928​
486​
315​
633​
246​
870​
693​
911​
503​
456​
783​
642​
810​
869​
292​
356​
683​
174​
C
100​
763​
368​
428​
717​
785​
821​
930​
516​
372​
692​
243​
947​
105​
237​
826​
665​
679​
622​
253​
and need below output in a separate sheet
Week Num123
Part NumberTotal Phy issueTotal SAP issueTotal Phy issueTotal SAP issueTotal Phy issueTotal SAP issue
A
B
C
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Try this:

Book1
ABCDEFGHIJKLMNOPQRSTUVWX
1Date2024-01-012024-01-012024-01-012024-01-012024-01-012024-01-012024-01-032024-01-032024-01-052024-01-052024-01-062024-01-062024-01-072024-01-072024-01-082024-01-082024-01-092024-01-092024-01-102024-01-102024-01-112024-01-112024-01-12
2Part NumberOpeningReceiptPhy issueSAP issueClosingDiffPhy issueSAP issuePhy issueSAP issuePhy issueSAP issuePhy issueSAP issuePhy issueSAP issuePhy issueSAP issuePhy issueSAP issuePhy issueSAP issuePhy issue
3A100095818200674609459996889697521323234363608805743429809417223
4B100092592800486315633246870693911503456783642810869292356683174
5C100076336800428717785821930516372692243947105237826665679622253
6and need below output in a separate sheet
711111111111122222222222
8Week Num123
9Part NumberTotal Phy issueTotal SAP issueTotal Phy issueTotal SAP issueTotal Phy issueTotal SAP issue
10A298023370
11B291430710
12C290631630
Sheet1
Cell Formulas
RangeFormula
B7:X7B7=WEEKNUM(B1)
B10:D12B10=SUMPRODUCT((SUBSTITUTE(B$9,"Total ","")=($B$2:$X$2))*(($A10=$A$3:$A$5))*($B$3:$X$5)*(WEEKNUM(1*$B$1:$X$1)=B$8))
 
Upvote 0
thank you , can you explain how this is verifying column heading?
 
Upvote 0
It is array math with True and False multiplication:

(I"m sorry the column formatting is all goofy in the xl2bb mini sheet below, I can't figure out how to keep merged cells aligned with the non merged cells).
If you paste this into your workbook, i hope you can read it better. When looking here, you need to scroll to right to see the formula results.

Book1
ABCDEFGHIJKLMNOPQRSTUVWX
1Date2024-01-012024-01-012024-01-012024-01-012024-01-012024-01-012024-01-032024-01-032024-01-052024-01-052024-01-062024-01-062024-01-072024-01-072024-01-082024-01-082024-01-092024-01-092024-01-102024-01-102024-01-112024-01-112024-01-12
2Part NumberOpeningReceiptPhy issueSAP issueClosingDiffPhy issueSAP issuePhy issueSAP issuePhy issueSAP issuePhy issueSAP issuePhy issueSAP issuePhy issueSAP issuePhy issueSAP issuePhy issueSAP issuePhy issue
3A100095818200674609459996889697521323234363608805743429809417223
4B100092592800486315633246870693911503456783642810869292356683174
5C100076336800428717785821930516372692243947105237826665679622253
6
711111111111122222222222
8Week Num123
9Part NumberTotal Phy issueTotal SAP issueTotal Phy issueTotal SAP issueTotal Phy issueTotal SAP issue
10A298023370
11B291430710
12C290631630
13
14Breaking down the formula in cell B10:
15
16This first part strips out the "Total " of the output column header description, and finds matches in the data header. This give you all the columns that match the column header description.
17=(SUBSTITUTE(B$9,"Total ","")=($B$2:$X$2))
18FALSEFALSETRUEFALSEFALSEFALSETRUEFALSETRUEFALSETRUEFALSETRUEFALSETRUEFALSETRUEFALSETRUEFALSETRUEFALSETRUE
19
20This first part strips out the "Total " of the output column header description, and finds matches in the data header. This give you all the columns that match the column header description.
21=(($A10=$A$3:$A$5))*($B$3:$X$5)
22100095818200674609459996889697521323234363608805743429809417223
2300000000000000000000000
2400000000000000000000000
25
26This first part strips out the "Total " of the output column header description, and finds matches in the data header. This give you all the columns that match the column header description.
27=(WEEKNUM(1*$B$1:$X$1)=B$8)
28TRUETRUETRUETRUETRUETRUETRUETRUETRUETRUETRUETRUEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSE
29
30This first part strips out the "Total " of the output column header description, and finds matches in the data header. This give you all the columns that match the column header description.
31=((SUBSTITUTE(B$9,"Total ","")=($B$2:$X$2))*(($A10=$A$3:$A$5))*($B$3:$X$5)*(WEEKNUM(1*$B$1:$X$1)=B$8))
320095800067404590889000000000000
3300000000000000000000000
3400000000000000000000000
35
36
37
38SUMPRODUCT function puts it all together.
39
40=((SUBSTITUTE(B$9,"Total ","")=($B$2:$X$2))*(($A10=$A$3:$A$5))*($B$3:$X$5)*(WEEKNUM(1*$B$1:$X$1)=B$8))
Sheet1
Cell Formulas
RangeFormula
B7:X7B7=WEEKNUM(B1)
B10:D12B10=SUMPRODUCT((SUBSTITUTE(B$9,"Total ","")=($B$2:$X$2))*(($A10=$A$3:$A$5))*($B$3:$X$5)*(WEEKNUM(1*$B$1:$X$1)=B$8))
B18:X18B18=(SUBSTITUTE(B$9,"Total ","")=($B$2:$X$2))
B22:X24B22=(($A10=$A$3:$A$5))*($B$3:$X$5)
B28:X28B28=(WEEKNUM(1*$B$1:$X$1)=B$8)
B32:X34B32=((SUBSTITUTE(B$9,"Total ","")=($B$2:$X$2))*(($A10=$A$3:$A$5))*($B$3:$X$5)*(WEEKNUM(1*$B$1:$X$1)=B$8))
Dynamic array formulas.
 
Last edited:
Upvote 0
Solution

Forum statistics

Threads
1,223,886
Messages
6,175,191
Members
452,616
Latest member
intern444

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