SUMIFS filtering on dotline

mporter785

New Member
Joined
Jun 14, 2022
Messages
21
Office Version
  1. 365
Platform
  1. Windows
forum_ex.xlsx
ABCDEFGHIJ
1DescritptionMaterial NumberEXCEL DESCRIPTIONProd_TypeProd_Cat.Time SavedNumber w/0 dotlineNumber with DotlineTime Saved (W/o) Time Save With
2MD20 SS HousingsV353378.B01HSG,MD20,MACH,304HOUSINGMD691854108
3MD20 GI Housings IndiaV353377.B01HSG,MD20,MACH,GIHOUSINGMD3234769141
Airlocks
Cell Formulas
RangeFormula
G2G2=SUM(SUMIFS(sab_prod!F:F,sab_prod!G:G,"*MD20 AIR*",sab_prod!M:M,{"*SS*","*304*","*316*"},sab_prod!B:B,"<>*.*",shipact,">="&Airlocks!$L$3,shipact,"<="&Airlocks!$L$4,cancel1,"FALSE"))
H2H2=SUM(SUMIFS(sab_prod!F:F,sab_prod!G:G,"*MD20 air*",sab_prod!M:M,{"*SS*","*304*","*316*"},sab_prod!J:J,">="&Airlocks!$L$3,sab_prod!J:J,"<="&Airlocks!$L$4,cancel1,"FALSE"))
I2:I3I2='offloaded parts.xlsx'!TBL_SUM[@[Time Saved]]*'offloaded parts.xlsx'!TBL_SUM[@[Number w/0 dotline]]
J2:J3J2='offloaded parts.xlsx'!TBL_SUM[@[Time Saved]]*'offloaded parts.xlsx'!TBL_SUM[@[Number with Dotline]]
G3G3=SUM(SUMIFS(sab_prod!F:F,sab_prod!G:G,"*MD20 AIR*",sab_prod!M:M,{"*GI*","*CS*"},sab_prod!B:B,"<>*.*",shipact,">="&Airlocks!$L$3,shipact,"<="&Airlocks!$L$4,cancel1,"FALSE"))
H3H3=SUM(SUMIFS(sab_prod!F:F,sab_prod!G:G,"*MD20 air*",sab_prod!M:M,{"*GI*","*CS*"},sab_prod!J:J,">="&Airlocks!$L$3,sab_prod!J:J,"<="&Airlocks!$L$4,cancel1,"FALSE"))
Named Ranges
NameRefers ToCells
cancel1=sab_prod!$R:$RG2:H3
shipact=sab_prod!$Q:$QG2:G3



job numberColumn1itemplantcustomerqtydescriptiondeptship-datejob-plnshp-plnPricemch-matmch-hsgmch-eplmch-rtrship-actcancelmch-cmplepl-stockrtr-stockmisc-stockedate
11004616771010SABWESTLAKE POLYMERS LP1 MD20 AIRLOCKM/S4/8/20224/1/20228097SSSSSP XMD20,SS,OE,8VN,FR8,C14/7/2022 0:00FALSETRUETRUETRUETRUEApril 2022
11004643891010SABJOHNSON MATTHEY PROCESS1 MD20 AIRLOCKM/S4/8/20224/1/202211058304L304L XSP CP 304L XMD20,SS,CE,8VN,FR8,SPCL4/14/2022 0:00FALSETRUETRUETRUETRUEApril 2022
11004645701010SABHEARTLAND FOOD PRODUCTS1 MD20 AIRLOCKM/S5/13/20225/6/20229628SSSS VNT XSP XMD20,SS,OE,8VN,ADJ32,CG80,SPCL 6-85/18/2022 0:00FALSETRUETRUETRUETRUEMay 2022
11004646551010SABEMS CHEMIE NORTH AMERICA INC1 MD20 AIRLOCKM/S4/8/20224/1/20226550SSSSSPMD20,SS,OE,8VN,FR16,C14/7/2022 0:00FALSETRUETRUETRUETRUEApril 2022
11004658102020SABSOUTHWIRE MC CABLE1 MD20 AIRLOCKM/S5/13/20225/6/202211484SSSSSP XMD20,304L,OE,8VN,FR8,CG24,RV,C15/11/2022 0:00FALSETRUETRUETRUETRUEMay 2022
11004658983030SABSPECTRUM BRANDS PET GROUP INC1 MD20 AIRLOCKM/S6/3/20226/1/20227362SSSSSP XMD20,304L,OE,8VN,FR8,C1FALSETRUETRUETRUETRUEJune 2022
11004680551010SABLANXESS CORPORATION1 MD20 AIRLOCKM/S5/27/20225/20/20229516316SS316SS XSP XMD20,316,OE,8VN,FR8,C15/23/2022 0:00FALSETRUETRUETRUETRUEMay 2022
11004680881010SABICL SPECIALTY PRODUCTS INC1 MD20 AIRLOCKM/S7/1/20226/24/202216240SSSSSP CPRETURN-NEDOXFALSEFALSEFALSEFALSETRUEJune 2022
11004693571010SABDANISCO1MD20 AIRLOCK DANISCOM/S5/20/20225/13/20227848SSSS VNT PORT XSP CPXMD20,.304L,CE,8VN,FR16,CG80,C15/23/2022 0:00FALSETRUETRUETRUETRUEMay 2022
11004713501010SABHEARTLAND FOOD PRODUCTS1MD20 AIRLOCK HEARTLAND PET FOODM/S6/10/20226/3/202210037SSSSSP XMD20,304L,OE,8VN,FR8,CG80,CW,C1FALSETRUETRUETRUETRUEJune 2022
11004716721010SABAMCOR WISCONSIN LLC1 MD20 AIRLOCKM/S6/17/20226/10/20228977SSSSSP XMD20,304L,CE,8VN,FR8,C1FALSEFALSETRUETRUETRUEJune 2022
11004721651010SABECOLAB KAY CHEMICAL CO1 MD20 AIRLOCKM/S6/10/20226/3/202212784316L316L 32RA XSP 32RA XMD20,316,OE,8VN,FR16,CG150,RV,SPCL 32RAFALSEFALSETRUETRUETRUEJune 2022
11004724441010SABRB MANUFACTURING LLC1MD20 AIRLOCK RB MANUFACTURING LLCM/S7/15/20227/8/20228431SSSS XSP CP XMD20,304L,CE,8VN,FR8,C1FALSEFALSEFALSEFALSETRUEJuly 2022
11004680884040SABICL SPECIALTY PRODUCTS INC1 MD20 ROTORM/S7/1/20226/24/20222519SSNANARETURN=NEDOXFALSEFALSETRUEFALSETRUEJune 2022
11004713591010SABHEARTLAND FOOD PRODUCTS1OE8,MD20,FR1/8,C1,80,304/L,CW *M/S4/22/20224/18/20221505304LNANAMD20,304L,OE,8VN,FR8,CG80,C1,CW4/26/2022 0:00FALSETRUETRUEFALSETRUEApril 2022
110046808810.110.1SABICL SPECIALTY PRODUCTS INC1 MD20 AIRLOCK - food grade nedoxM/S7/1/20226/17/2022SSNANAMD20,304L,CE,8VN,FR16,RV,C2 NEDOX XFALSEFALSETRUEFALSETRUEJune 2022
110046808840.140.1SABICL SPECIALTY PRODUCTS INC1 MD20 ROTOR - food grade nedoxM/S7/1/20226/17/2022 0:00304LNANAMD20,MD20,304L,CE,8VN,FR16,RV,C1 NEDOX XFALSEFALSETRUEFALSETRUEJune 2022
11004739441010SABWACKER CHEMICAL CORPORATION1 MD20 AIRLOCKM/S8/12/20228/5/2022 0:0014412316SS316SSSP CP TS4MD20,316,CE,8VN,FR16,RV,C1FALSEFALSEFALSEFALSETRUEAugust 2022
11004757651010SABBIG HEART PET BRANDS1 MD20 AIRLOCKM/S6/10/20226/3/2022 0:000SSSSSP XMD20,SS,OE,8VN,FR8,CG80,C26/7/2022 0:00FALSETRUETRUETRUETRUEJune 2022
11004762971010SABVAN DIEST SUPPLY CO1OE8,MD20,FR1/8,C1,80RP,304/LM/S6/29/20226/24/2022 0:001939304LNANAMD20,304L,OE,8VN,FR8,CG80,RP,C1FALSEFALSETRUEFALSETRUEJune 2022


Given the SUMIFS equation to filter out the accurate count of the particular part, I want to sum all the items data table above. if there is a dot item on the item column, for example "10.1", I want to count only the 10.1 and not the 10 associated with the same customer. So, the customer ICL specialty products should only be counted once instead of twice. because it has a 10.1 and a 10. IF there is no dotline then the dates should be filtered between the [job-pln] column, if there is a dotline column, the result should be filtered between the [ship-act] column. know it's hard to explain. thanks for the help
 
My bad...I didn't understand that. The 'maxitm' formula/column accepts (assigns a flag of 1) if either of two scenarios is true:
  1. there is a singular job number entry paired with only one item number that has no decimal component (which is why it seemed odd to call this a "with dot" condition...because there is no dot), and
  2. there are multiple item numbers that have a common integer component and they all share the same job number, in which case only the maximum of these is accepted, and the other smaller decimals and the pure integer entry (if it exists) are ignored and flagged with a 0.
Based on your last clarification, it sounds like you want #1 and a variant of #2 that accepts all of the decimals but ignores the pure integer entry if it exists for this condition. Is that right?...and you're right, that's not what my revision does in post #29.
 
Upvote 0

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Okay...that's a lot trickier because we want to keep the pure integers sometimes (when there are no decimal companions) but exclude them at other times (when there are decimal companions). I think this will indeed need to retain the helper column since we'll need to evaluate each row in [sab_prod] separately. Here is what I came up with for the former 'maxitm' helper column, now renamed 'dotitm'...formula shown in Y2 and pulled down to cover all rows in table:
forum_ex_v2.xlsx
Y
1dotitm
21
sab_prod
Cell Formulas
RangeFormula
Y2Y2=LET(jigrp,FILTER(Table1[item],(Table1[job number]=Table1[@[job number]])*(INT(Table1[item])=INT(Table1[@item]))),IF(MOD(Table1[@item],1)<>0,1,IF(AND(COUNT(jigrp)=1,MOD(Table1[@item],1)=0),1,0)))

This uses the FILTER function to assemble the relatively small set of item numbers where those item numbers share a common integer component and the same job number...and this is known as the job-item group, or 'jigrp' for short. Then we first evaluate the current row's item number and if it is a decimal, we assign a 1. If it is not a decimal (so it's a pure integer) AND it is the only element in the 'jigrp' we also assign a 1...otherwise we assign a 0.

Then we're back to the main LET function that uses this helper column for 'wdot':
Excel Formula:
=LET(desc1,{"MD20 air"},   desc2,{"E/P","ENDPLATE","END PLATE"},   desc3,{"MD20"},   desc4,{"ROTOR"},   desc5,{"*"},
         matg1,{"SS","304","316"},   matg2,{"GI","CS"},   matg3,{"*"},
         tblprod,sab_prod!$A$2:$R$1792,
         wdot,sab_prod!$Y$2:$Y$1792,   wodot,SIGN(MOD(INDEX(tblprod,,3),1)=0),
         dateact,INDEX(tblprod,,17),   datedep,IF(MOD(INDEX(tblprod,,3),1)<>0,INDEX(tblprod,,10),INDEX(tblprod,,17)),
         descA,desc5,
         descB, desc4,
         mats, matg3,
         date, dateact,
         itemtype, wodot,
         res,FILTER( tblprod,
                    (MMULT(--(ISNUMBER(SEARCH(descA,INDEX(tblprod,,7)))),SEQUENCE(COUNTA(descA),1,1,0))>0)*
                    (MMULT(--(ISNUMBER(SEARCH(descB,INDEX(tblprod,,7)))),SEQUENCE(COUNTA(descB),1,1,0))>0)*
                    (MMULT(--(ISNUMBER(SEARCH(mats,INDEX(tblprod,,13)))),SEQUENCE(COUNTA(mats),1,1,0))>0)*
                    (date>=$L$3)*
                    (date<=$L$4)*
                    (INDEX(tblprod,,18)=FALSE)*
                    (itemtype) ),
         IFERROR(SUM(INDEX(res,,6)),0))
 
Upvote 0
Thank you so much! Can I ask for one more line in the main LET function to exclude any description containing "rebuild" or "repair"?

I have tried *(INDEX(tblprod,,7)=IF(OR("rebuild","repair"),0,"")*

and other variations of

desc4,{"REBUILD","REPAIR"}
descC, desc4,
((MMULT(--(ISNUMBER(SEARCH(descC,INDEX(tblprod,,7)))),SEQUENCE(COUNTA(descC),1,1,0))>0)*-1)*
 
Upvote 0
I haven't tested, but this should work:
Excel Formula:
=LET(desc1,{"MD20 air"},   desc2,{"E/P","ENDPLATE","END PLATE"},   desc3,{"MD20"},   desc4,{"ROTOR"},   desc5,{"*"},  descexclude,{"repair","rebuild"},
         matg1,{"SS","304","316"},   matg2,{"GI","CS"},   matg3,{"*"},
         tblprod,sab_prod!$A$2:$R$1792,
         wdot,sab_prod!$Y$2:$Y$1792,   wodot,SIGN(MOD(INDEX(tblprod,,3),1)=0),
         dateact,INDEX(tblprod,,17),   datedep,IF(MOD(INDEX(tblprod,,3),1)<>0,INDEX(tblprod,,10),INDEX(tblprod,,17)),
         descA,desc5,
         descB, desc4,
         descC, descexclude,
         mats, matg3,
         date, dateact,
         itemtype, wodot,
         res,FILTER( tblprod,
                    (MMULT(--(ISNUMBER(SEARCH(descA,INDEX(tblprod,,7)))),SEQUENCE(COUNTA(descA),1,1,0))>0)*
                    (MMULT(--(ISNUMBER(SEARCH(descB,INDEX(tblprod,,7)))),SEQUENCE(COUNTA(descB),1,1,0))>0)*
                    (MMULT(--(ISNUMBER(SEARCH(descC,INDEX(tblprod,,7)))),SEQUENCE(COUNTA(descC),1,1,0))=0)*
                    (MMULT(--(ISNUMBER(SEARCH(mats,INDEX(tblprod,,13)))),SEQUENCE(COUNTA(mats),1,1,0))>0)*
                    (date>=$L$3)*
                    (date<=$L$4)*
                    (INDEX(tblprod,,18)=FALSE)*
                    (itemtype) ),
         IFERROR(SUM(INDEX(res,,6)),0))
This creates a new variable called 'descexclude' where you can compile any terms that should be excluded (i.e., if these test strings exist in the Description field, ignore that row). Then this 'descexclude' array is assigned to the 'descC' variable name (you could avoid this step and simply hardwire 'descexclude' into the MMULT function I'm about to describe, but this approach keeps everything consistent with regard to how you build a list of search terms and then pass them to another variable whose name is found in the general main formula). Then in the main FILTER function, recall that we are filtering 'tblprod' based on what is returned as TRUE after all of the filtering criteria are applied. So in the other MMULT formulas, if any of the search terms are found, the sum-by-row operation described by the MMULT formula will return a number greater than 0 indicating the number of search terms found in each cell as one moves down the Description column. For that reason, when we want to require at least one of the search terms to be present as a condition to consider the row, we establish the condition with the basic expression MMULT>0. And if we want to exclude some terms, we require that MMULT=0. Then if an undesirable term is found, MMULT will return a value >0, and since that does not satisfy the MMULT=0 criteria, this part of the formula will evaluate to FALSE and cause the row to be ignored. Let me know if this works.
 
Upvote 0
Solution

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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