Excel: 在 COUNTIF 中嵌套 IF 条件?

Excel: Nest IF condition inside COUNTIF?

我有几个下拉列表来确定应该使用什么作为数据计算的条件,它们是:

所以不要像这样写一个冗长而复杂的公式(我会用与文本字符串对应的实际 COUNTIFS 公式替换文本字符串):

=IFS(
         AND(radioCheck=1,ISBLANK(D3),NOT(ISBLANK(D5)),NOT(ISBLANK(D6))),"Country blank",
         AND(radioCheck=1,ISBLANK(D3),ISBLANK(D5),NOT(ISBLANK(D6))),"Country Month blank",
         AND(radioCheck=1,ISBLANK(D3),NOT(ISBLANK(D5)),ISBLANK(D6)),"Country Channel blank",

         AND(radioCheck=1,NOT(ISBLANK(D3)),ISBLANK(D5),NOT(ISBLANK(D6))),"Month blank",
         AND(radioCheck=1,ISBLANK(D3),ISBLANK(D5),NOT(ISBLANK(D6))),"Country Month blank",
         AND(radioCheck=1,NOT(ISBLANK(D3)),ISBLANK(D5),ISBLANK(D6)),"Month Channel blank",

         AND(radioCheck=1,NOT(ISBLANK(D3)),NOT(ISBLANK(D5)),ISBLANK(D6)),"Channel blank",
         AND(radioCheck=1,ISBLANK(D3),NOT(ISBLANK(D5)),ISBLANK(D6)),"Country Channel blank",
         AND(radioCheck=1,NOT(ISBLANK(D3)),ISBLANK(D5),ISBLANK(D6)),"Month Channel blank",

         AND(radioCheck=1,ISBLANK(D3),ISBLANK(D5),ISBLANK(D6)),"Country Month Channel blank",
         AND(radioCheck=1,NOT(ISBLANK(D3)),NOT(ISBLANK(D5)),NOT(ISBLANK(D6))),"Country Month Channel Chosen",

         AND(radioCheck=2,ISBLANK(D3),NOT(ISBLANK(D5)),NOT(ISBLANK(D6))),"Supervisor blank",
         AND(radioCheck=2,ISBLANK(D3),ISBLANK(D5),NOT(ISBLANK(D6))),"Supervisor Month blank",
         AND(radioCheck=2,ISBLANK(D3),NOT(ISBLANK(D5)),ISBLANK(D6)),"Supervisor Channel blank",

         AND(radioCheck=2,NOT(ISBLANK(D3)),ISBLANK(D5),NOT(ISBLANK(D6))),"Month blank",
         AND(radioCheck=2,ISBLANK(D3),ISBLANK(D5),NOT(ISBLANK(D6))),"Supervisor Month blank",
         AND(radioCheck=2,NOT(ISBLANK(D3)),ISBLANK(D5),ISBLANK(D6)),"Month Channel blank",

         AND(radioCheck=2,NOT(ISBLANK(D3)),NOT(ISBLANK(D5)),ISBLANK(D6)),"Channel blank",
         AND(radioCheck=2,ISBLANK(D3),NOT(ISBLANK(D5)),ISBLANK(D6)),"Supervisor Channel blank",
         AND(radioCheck=2,NOT(ISBLANK(D3)),ISBLANK(D5),ISBLANK(D6)),"Month Channel blank",

         AND(radioCheck=2,ISBLANK(D3),ISBLANK(D5),ISBLANK(D6)),"Supervisor Month Channel blank",
         AND(radioCheck=2,NOT(ISBLANK(D3)),NOT(ISBLANK(D5)),NOT(ISBLANK(D6))),"Supervisor Month Channel Chosen"
)

(radiocheck = 1 表示国家下拉,radiocheck 2 表示主管下拉。D3 = 国家或主管下拉,D5 是月份下拉,D6 是频道下拉)

..对于我想根据这些 three/four 条件计算的数据的每个字段,我希望能够实现这样的结果(在示例中,月份变为空白,所以- 删除月份作为条件):

即:

=COUNTIFS(rawNPS,">=9",
          IF($D="","",rawYYMMM,$D),
          rawAgent,K20,rawChannel,$D
)

..所以如果在 D5 的下拉列表中没有选择,那么 rawYYMMM 将不是公式中的条件。

这有可能吗?我无法提供比这更多的例子,

如果 rawYYMMMD5 中的条目是正数,非零数字:

=COUNTIFS(rawNPS,">=9",rawYYMMM,IF($D="",">0",$D),rawAgent,K20,rawChannel,$D)

如果 rawYYMMMD5 中的条目是数字,可以是正数、负数或零:

=SUM(COUNTIFS(rawNPS,">=9",rawYYMMM,IF($D="",{">0","<=0"},$D),rawAgent,K20,rawChannel,$D))

如果 rawYYMMMD5 中的条目是文本:

=COUNTIFS(rawNPS,">=9",rawYYMMM,IF($D="","*",$D),rawAgent,K20,rawChannel,$D)