问题
I have the following table
On each day a single sport activity is organized and attending students receive bonus points. Students can attend activities each day to receive points.
Based on existing columns I need to calculate total bonus points for each student (column I)
If in column D I had number of points for that day I could solve this with a SUMIF but as that is not the case I am not sure how to incorporate values from F which I need for summing.
Any help would be greatly appreciated.
回答1:
Use this array formula:
=SUM(SUMIFS(F:F,E:E,INDEX(C:C,N(IF(1,MODE.MULT(IF(ISNUMBER(SEARCH("," & H2 & ",","," & $B$2:$B$7 & ",")),ROW($B$2:$B$7)*{1,1})))))))
Being an array formula it needs to be confirmed with Ctrl-Shift-Enter instead of Enter when exiting edit mode.
Edit, based on TomSharpes but with SUMIFS instead of OFFSET.
=SUMPRODUCT(ISNUMBER(SEARCH("," & H2 & ",","," & $B$2:$B$7 & ","))*SUMIFS($F$2:$F$4,$E$2:$E$4,$C$2:$C$7))
Note: I used SEARCH to remove the case match and bracketed the inputs and checks with ,
so Ann
is not found in Anne
回答2:
=SUMPRODUCT(ISNUMBER(FIND(H2,$B$2:$B$7))*N(OFFSET($F$1,MATCH($C$2:$C$7,$E$2:$E$4,0),0)))
来源:https://stackoverflow.com/questions/49072450/excel-sum-values-based-on-values-in-another-column-and-mapped-values