Excel: Sum values based on values in another column and mapped values

落花浮王杯 提交于 2020-01-05 05:40:28

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!