SOLVED
Home

Excel formula Help Needed SUMPRODUCT

%3CLINGO-SUB%20id%3D%22lingo-sub-552335%22%20slang%3D%22en-US%22%3EExcel%20formula%20Help%20Needed%20SUMPRODUCT%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-552335%22%20slang%3D%22en-US%22%3E%3CP%3EPlease%20see%20attached%20workbook.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECurrently%2C%20I%20calculate%20this%20manually%20using%20help%20column%20and%20it%20is%20very%20manual%20and%20time%20consuming.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAppreciate%20your%20help%20on%20a%20formula%20that%20I%20can%20place%20in%20Column%20L%2C%20so%20that%20I%20get%20rid%20of%20the%20helper%20columns%20of%20D%20and%20E.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20very%20much.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-552335%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-552692%22%20slang%3D%22en-US%22%3ERe%3A%20Excel%20formula%20Help%20Needed%20SUMPRODUCT%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-552692%22%20slang%3D%22en-US%22%3EI%20don't%20think%20you%20can%20do%20away%20with%20the%20days%20worked%20helper%20column%20because%20you%20have%20information%20in%20the%20summary%20to%20the%20right%20of%20the%20data%20you%20use%20(start%20and%20end%20dates)%20and%20it%20is%20not%20possible%20to%20manipulate%20this%20data%20the%20way%20you%20have%20it%20structured.%20You%20could%20restructure%20the%20way%20you%20enter%20data%20in%20the%20sheet!%3CBR%20%2F%3E%3CBR%20%2F%3EIn%20your%20current%20layout%2C%20you%20can%20do%20away%20with%20column%20E%2C%20by%20using%20an%20array%20formula%20in%20Column%20L%20ie%20enter%20it%20with%20Shift-Control-Enter%3CBR%20%2F%3E%3DSUM((%24A%242%3A%24A%2419%3D%24H3)*(%24C%242%3A%24C%2419)*(%24D%242%3A%24D%2419))%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-553413%22%20slang%3D%22en-US%22%3ERe%3A%20Excel%20formula%20Help%20Needed%20SUMPRODUCT%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-553413%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F122716%22%20target%3D%22_blank%22%3E%40Flora%20Sim%3C%2FA%3E%26nbsp%3B%2C%20it's%20possible%20to%20avoid%20helper%20columns%20with%20formulas%20like%20this%20for%20the%20amount%3C%2FP%3E%0A%3CPRE%3E%3DSUMPRODUCT(%0A%20%20%20(%24A%243%3A%24A%2420%3D%24F3)*%24C%243%3A%24C%2420*%0A%20%20%20(OFFSET(%24B%243%3A%24B%2420%2C-1%2C0)-%24B%243%3A%24B%2420)*%0A%20%20%20(%24B%243%3A%24B%2420%26lt%3BAGGREGATE(14%2C6%2C1%2F(%24A%243%3A%24A%2420%3D%24F3)*%24B%243%3A%24B%2420%2C1))*%0A%20%20%20(%24B%243%3A%24B%2420%26gt%3BAGGREGATE(15%2C6%2C1%2F(%24A%243%3A%24A%2420%3D%24F3)*%24B%243%3A%24B%2420%2C1))%0A)%2B%0A%20%20%20(%24H3-AGGREGATE(14%2C6%2C1%2F(%24A%243%3A%24A%2420%3D%24F3)*%24B%243%3A%24B%2420%2C1))*%0A%20%20%20%20%20%20INDEX(%24C%243%3A%24C%2420%2C%0A%20%20%20%20%20%20%20%20%20MATCH(1%2CINDEX(%0A%20%20%20%20%20%20%20%20%20%20%20%20(%24A%243%3A%24A%2420%3D%24F3)*%0A%20%20%20%20%20%20%20%20%20%20%20%20(%24B%243%3A%24B%2420%3DAGGREGATE(14%2C6%2C1%2F(%24A%243%3A%24A%2420%3D%24F3)*%24B%243%3A%24B%2420%2C1))%2C%0A%20%20%20%20%20%20%20%20%200)%2C%0A%20%20%20%20%20%200))%2B%0A%20%20%20(AGGREGATE(15%2C6%2C1%2F(%24A%243%3A%24A%2420%3D%24F3)*%24B%243%3A%24B%2420%2C2)-%24G3)*%0A%20%20%20%20%20%20INDEX(%24C%243%3A%24C%2420%2C%0A%20%20%20%20%20%20%20%20%20MATCH(1%2CINDEX(%0A%20%20%20%20%20%20%20%20%20%20%20%20(%24A%243%3A%24A%2420%3D%24F3)*%0A%20%20%20%20%20%20%20%20%20%20%20%20(%24B%243%3A%24B%2420%3DAGGREGATE(15%2C6%2C1%2F(%24A%243%3A%24A%2420%3D%24F3)*%24B%243%3A%24B%2420%2C1)%20)%2C%0A%20%20%20%20%20%20%20%20%200)%2C%0A%20%20%200))%3C%2FPRE%3E%0A%3CP%3ESee%20Sheet1%2C%20I%20added%20empty%20row%20after%20the%20headers%20of%20main%20table%20not%20to%20complicate%20formulas%20more.%20Perhaps%20it%20could%20be%20simplified%2C%20but%20in%20any%20case%20will%20be%20bit%20hard%20for%20the%20maintenance.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIt's%20nothing%20wrong%20with%20helpers%20column%2C%20but%20only%20if%20they%20are%20help.%20In%20your%20case%20you%20generates%20it%20practically%20manually%20checking%20the%20names%20and%20dates%20and%20changing%20formula%20in%20helper%20column%20depends%20on%20their%20combination.%20I'd%20suggest%20to%20automate%20number%20of%20days%20column%20like%3C%2FP%3E%0A%3CPRE%3E%3DIF(B2%3DAGGREGATE(14%2C6%2C1%2F(%24A%242%3A%24A%2419%3D%24A2)*%24B%242%3A%24B%2419%2C1)%2C%0A%20%20%20INDEX(%24I%243%3A%24I%2414%2CMATCH(%24A2%2C%24G%243%3A%24G%2414%2C0))%2C%0A%20%20%20%24B1)-%0A%20IF(B2%3DAGGREGATE(15%2C6%2C1%2F(%24A%242%3A%24A%2419%3D%24A2)*%24B%242%3A%24B%2419%2C1)%2C%0A%20%20%20INDEX(%24H%243%3A%24H%2414%2CMATCH(%24A2%2C%24G%243%3A%24G%2414%2C0))%2C%0A%20%20%20B2)%3C%2FPRE%3E%0A%3CP%3EAfter%20that%20use%20summary%20formula%20for%20the%20amount%20as%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F338750%22%20target%3D%22_blank%22%3E%40Geoff1951%3C%2FA%3E%26nbsp%3B%20suggested%2C%20the%20only%20I'd%20avoid%20array%20formulas%20their%20possible%2C%20thus%3C%2FP%3E%0A%3CPRE%3E%3DSUMPRODUCT((%24A%242%3A%24A%2419%3D%24G3)*%24C%242%3A%24C%2419*%24D%242%3A%24D%2419)%3C%2FPRE%3E%0A%3CP%3ESee%20Sheet2%20attached.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-554728%22%20slang%3D%22en-US%22%3ERe%3A%20Excel%20formula%20Help%20Needed%20SUMPRODUCT%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-554728%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20is%20genius%20work!%26nbsp%3B%20Thank%20you%20so%20much.%20I%20almost%20gave%20up%2C%20I%20thought%20it%20could%20not%20be%20done%20without%20use%20of%20helper%20column.%20But%20your%20formula%20amazed%20me.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20so%20very%20much.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-554746%22%20slang%3D%22en-US%22%3ERe%3A%20Excel%20formula%20Help%20Needed%20SUMPRODUCT%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-554746%22%20slang%3D%22en-US%22%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F338750%22%20target%3D%22_blank%22%3E%40Geoff1951%3C%2FA%3E%3CBR%20%2F%3E%3CBR%20%2F%3Ethanks%20for%20your%20help%20as%20well.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-554811%22%20slang%3D%22en-US%22%3ERe%3A%20Excel%20formula%20Help%20Needed%20SUMPRODUCT%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-554811%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F122716%22%20target%3D%22_blank%22%3E%40Flora%20Sim%3C%2FA%3E%26nbsp%3B%2C%20you%20are%20welcome%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-554866%22%20slang%3D%22en-US%22%3ERe%3A%20Excel%20formula%20Help%20Needed%20SUMPRODUCT%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-554866%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F122716%22%20target%3D%22_blank%22%3E%40Flora%20Sim%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20can%20achieve%20this%20by%20using%20this%20formula%20only.%20It%20requires%20no%20helper%20column.%3C%2FP%3E%0A%3CP%3E%26nbsp%3Bwith%20Control%20Shift%20Enter%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3DSUM((%24A%242%3A%24A%2419%3D%24E3)*(%24C%242%3A%24C%2419)*(IF(%24A%241%3A%24A%2418%3D%24E3%2C%24B%241%3A%24B%2418%2C%24G3)-IF(%24A%243%3A%24A%2420%3D%24E3%2C%24B%242%3A%24B%2419%2C%24F3)))%3C%2FPRE%3E%0A%3CP%3ESee%20attached%20file.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-555924%22%20slang%3D%22en-US%22%3ERe%3A%20Excel%20formula%20Help%20Needed%20SUMPRODUCT%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-555924%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F24499%22%20target%3D%22_blank%22%3E%40Jamil%20Mohammad%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWow!%26nbsp%3B%20%26nbsp%3BThis%20is%20amazing.%20I%20never%20thought%20you%20could%20do%20it%20with%20this%20short%20formula.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20very%20much!%3C%2FP%3E%3C%2FLINGO-BODY%3E
Flora Sim
Occasional Contributor

Please see attached workbook.

 

Currently, I calculate this manually using help column and it is very manual and time consuming.

 

Appreciate your help on a formula that I can place in Column L, so that I get rid of the helper columns of D and E.

 

Thank you very much.

7 Replies
I don't think you can do away with the days worked helper column because you have information in the summary to the right of the data you use (start and end dates) and it is not possible to manipulate this data the way you have it structured. You could restructure the way you enter data in the sheet!

In your current layout, you can do away with column E, by using an array formula in Column L ie enter it with Shift-Control-Enter
=SUM(($A$2:$A$19=$H3)*($C$2:$C$19)*($D$2:$D$19))
Solution

@Flora Sim , it's possible to avoid helper columns with formulas like this for the amount

=SUMPRODUCT(
   ($A$3:$A$20=$F3)*$C$3:$C$20*
   (OFFSET($B$3:$B$20,-1,0)-$B$3:$B$20)*
   ($B$3:$B$20<AGGREGATE(14,6,1/($A$3:$A$20=$F3)*$B$3:$B$20,1))*
   ($B$3:$B$20>AGGREGATE(15,6,1/($A$3:$A$20=$F3)*$B$3:$B$20,1))
)+
   ($H3-AGGREGATE(14,6,1/($A$3:$A$20=$F3)*$B$3:$B$20,1))*
      INDEX($C$3:$C$20,
         MATCH(1,INDEX(
            ($A$3:$A$20=$F3)*
            ($B$3:$B$20=AGGREGATE(14,6,1/($A$3:$A$20=$F3)*$B$3:$B$20,1)),
         0),
      0))+
   (AGGREGATE(15,6,1/($A$3:$A$20=$F3)*$B$3:$B$20,2)-$G3)*
      INDEX($C$3:$C$20,
         MATCH(1,INDEX(
            ($A$3:$A$20=$F3)*
            ($B$3:$B$20=AGGREGATE(15,6,1/($A$3:$A$20=$F3)*$B$3:$B$20,1) ),
         0),
   0))

See Sheet1, I added empty row after the headers of main table not to complicate formulas more. Perhaps it could be simplified, but in any case will be bit hard for the maintenance.

 

It's nothing wrong with helpers column, but only if they are help. In your case you generates it practically manually checking the names and dates and changing formula in helper column depends on their combination. I'd suggest to automate number of days column like

=IF(B2=AGGREGATE(14,6,1/($A$2:$A$19=$A2)*$B$2:$B$19,1),
   INDEX($I$3:$I$14,MATCH($A2,$G$3:$G$14,0)),
   $B1)-
 IF(B2=AGGREGATE(15,6,1/($A$2:$A$19=$A2)*$B$2:$B$19,1),
   INDEX($H$3:$H$14,MATCH($A2,$G$3:$G$14,0)),
   B2)

After that use summary formula for the amount as @Geoff1951  suggested, the only I'd avoid array formulas their possible, thus

=SUMPRODUCT(($A$2:$A$19=$G3)*$C$2:$C$19*$D$2:$D$19)

See Sheet2 attached.

@Sergei Baklan 

 

This is genius work!  Thank you so much. I almost gave up, I thought it could not be done without use of helper column. But your formula amazed me.

 

Thanks so very much.

@Geoff1951

thanks for your help as well.

@Flora Sim , you are welcome

@Flora Sim 

 

You can achieve this by using this formula only. It requires no helper column.

 with Control Shift Enter

 

=SUM(($A$2:$A$19=$E3)*($C$2:$C$19)*(IF($A$1:$A$18=$E3,$B$1:$B$18,$G3)-IF($A$3:$A$20=$E3,$B$2:$B$19,$F3)))

See attached file.

 

@Jamil Mohammad 

 

Wow!   This is amazing. I never thought you could do it with this short formula.

 

Thanks very much!

Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
16 Replies
flashing a white screen while open new tab
cntvertex in Discussions on
11 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
28 Replies
Early preview of Microsoft Edge group policies
Sean Lyndersay in Discussions on
65 Replies