与OR和的Sumifs

时间:2016-04-13 19:35:38

标签: excel sum sumifs

我有一个看起来像这样的数据集......

Group   Opportunity   Close Date    Stage   Yr Credited Probability Adjusted Credit
    Sigma   A           12/31/2016  Lost    2016          0.1
    Alpha   B           1/1/2016    Signed  2016          0.5
    Beta    C           7/26/2016   Review  2016          0.7
    Sigma   D - Loss    1/1/2016    Lost    2016          -1
    Alpha   E           12/31/2016  Review  2016          0.7
    Beta    F           1/25/2016   Pending 2016          0.6
    Sigma   G           12/31/2016  Review  2016          0.4
    Alpha   H           4/6/2014    Expired 2015          0.9
    Beta    I           5/14/2015   Pending 2015          0.1
    Sigma   J           12/31/2016  Review  2016          0.7
    Alpha   K - Loss    2/3/2016    Lost    2016          -0.5
    Beta    L           12/31/2016  Expired 2016          0.8
    Sigma   M           1/25/2016   Expired 2016          0.6
    Alpha   N           12/31/2016  Pending 2016          0.5
    Beta    O           12/31/2016  Pending 2016          0.4
    Sigma   P           12/31/2016  Pending 2016          0.3

我的目标之一是使用带AND和OR语句的SUMIFS函数。如果满足以下条件,公式应产生每组概率调整后的信用总和:阶段=审核或两个阶段=失去和机会包含“损失”

公式必须像SUMIFS公式一样运作,因为我还有其他标准要合并。但是,这部分标准并不像我那样直接。

2 个答案:

答案 0 :(得分:3)

使用SUMPRODUCT():

=SUMPRODUCT((($D$2:$D$50 = "Review")+(($D$2:$D$50 = "Lost")*(ISNUMBER(SEARCH("Loss",$B$2:$B$50))))>0)*($F$2:$F$50))

enter image description here

使用ANDOR的数组公式时,分别使用操作数*+

编辑:

添加了分组:

=SUMPRODUCT((($D$2:$D$50 = "Review")+(($D$2:$D$50 = "Lost")*(ISNUMBER(SEARCH("Loss",$B$2:$B$50))))>0)*($F$2:$F$50)*($A$2:$A$50=H2))

enter image description here

答案 1 :(得分:2)

单个组的替代SUMPRODUCT function

=SUMPRODUCT((A$2:INDEX(A:A, MATCH("zzz",A:A ))=H2)*
                 SIGN((D$2:INDEX(D:D, MATCH("zzz",A:A ))="review")+
                 (D$2:INDEX(D:D, MATCH("zzz",A:A ))="lost")*
                 (RIGHT(B$2:INDEX(B:B, MATCH("zzz",A:A )), 4)="loss")),
             F$2:INDEX(F:F, MATCH("zzz",A:A )))

您可以将换行符保留在该公式中,如果它可以帮助您理解它。

alpha_beta_sigma

SUMPRODUCT功能与AND / OR功能不兼容。使用+表示OR,*表示AND,并使用适当的包围提供层次结构。