如果值x在列A或B中且A不等于B,则为excel sum列

时间:2017-06-05 17:23:27

标签: excel sum

我需要一个总和if函数,它将返回John在B列而不是A列中的所有值。所以它应该只返回50以下。

Column A     Column B           Column C 
John         John, Steve, Fred  100
Steve        John               50
Fred         Fred, Steve        150

1 个答案:

答案 0 :(得分:1)

您可以使用此SUMIFS:

=SUMIFS(C:C,A:A,"<>*" & "John" & "*",B:B,"=*" & "John" & "*")

enter image description here

但这可能会导致误报,例如Ann也会看到Anne

要解决这个问题,您需要更改为SUMPRODUCT:

=SUMPRODUCT($C$1:$C$3,(ISERROR(SEARCH("," & "John" & ",","," & $A$1:$A$3 & ",")))*(ISNUMBER(SEARCH("," & "John" & ",","," & $B$1:$B$3 & ","))))

enter image description here