Excel Countifs计数一次重复的条目

我正在尝试创build一个计数重复条目一次的countifs公式。 看下面的示例数据集。 以“蔬菜”为单元格A1。

其中,我试图用数据1(C列)中出现的“1(ASS)”来计算未被捣碎的马铃薯(A列)受影响的KPI(列D)(B列)。 D列有两个空白单元和“N / A”,不能统计。 C列显示多选列表中的数据,并用逗号分隔。

我已经input公式来计算工作簿中单元格H2中KPI的总数(请参阅图像)。 答案是3.我使用的公式是

= COUNTIFS($ A $ 3:$ A $ 22,“Potato”,$ B $ 3:$ B $ 22,“<>”&“Mashed”,$ C $ 3:$ C $ 22,“ ”&$ F $ 3&“ ”, $ d $ 3:$ d $ 22 “<>” & “”,$ d $ 3:$ d $ 22 “<>” 和 “N / A”)

但是,我无法创build任何可以计算受影响的唯一KPI数量的任何内容。 我唯一的意思是统计一次/重复一次的条目。 H3中的答案应该是2(再次参见图片)。

在我的数据集中,如果需要的话,我可以创build一个新的列,但是如果有方法只使用一个公式,这是我的首选解决scheme来回答这个问题。

提前致谢。

Vegtable Type Data 1 KPIs Potato Peeled 1 (ASS) xxx,11 (ToW) xxx 1 ABC Potato Boiled 1 (ASS) xxx 1 ABC Potato Mashed 1 (ASS) xxx 3 ABC Potato Boiled 1 (ASS) xxx N/A Potato Boiled 1 (ASS) xxx N/A Potato Boiled 1 (ASS) xxx Potato Peeled 1 (ASS) xxx 7 ABC Potato Peeled 2 (ASS) xxx,8 (SGA) xxx 8 ABC Potato Peeled 2 (ASS) xxx 9 ABC Potato Peeled 2 (ASS) xxx 10 ABC Potato Peeled 8 (SGA) xxx Carrot Peeled 8 (SGA) xxx Carrot Peeled 8 (SGA) xxx 1 ABC Carrot Peeled 8 (SGA) xxx 2 ABC Carrot Boiled 8 (SGA) xxx 3 ABC Carrot Boiled 8 (SGA) xxx Carrot Boiled 1 (ASS) xxx,8 (SGA) xxx,11 (ToW) xxx Carrot Boiled 11 (ToW) xxx 4 ABC Carrot Boiled 11 (ToW) xxx 5 ABC Carrot Boiled 1 (ASS) xxx,11 (ToW) xxx 6 ABC 

在这里输入图像说明

尝试使用此数组公式( 请记住使用 Ctrl + Shift + Enterinput 公式

 =SUM(IF(($A$2:$A$21="Potato")*($B$2:$B$21<>"Mashed")*($C$2:$C$21="1 (ASS) xxx")*($D$2:$D$21<>"N/A")*($D$2:$D$21<>""),1/COUNTIFS($A$2:$A$21,"Potato",$B$2:$B$21,"<>"&"Mashed",$C$2:$C$21,"1 (ASS) xxx",$D$2:$D$21,"<>"&"",$D$2:$D$21,$D$2:$D$21),0)) 

使用通配符search的公式:

 =SUM(IF(($A$2:$A$21="Potato")*($B$2:$B$21<>"Mashed")*(ISNUMBER(SEARCH("*1 (ASS)*",$C$2:$C$21,1)))*($D$2:$D$21<>"N/A")*($D$2:$D$21<>""),1/COUNTIFS($A$2:$A$21,"Potato",$B$2:$B$21,"<>"&"Mashed",$C$2:$C$21,"*1 (ASS)*",$D$2:$D$21,"<>"&"",$D$2:$D$21,$D$2:$D$21),0)) 

单元格中带有通配符search和search文本的公式F2:

 =SUM(IF(($A$2:$A$21="Potato")*($B$2:$B$21<>"Mashed")*(ISNUMBER(SEARCH("*"&$F$2&"*",$C$2:$C$21,1)))*($D$2:$D$21<>"N/A")*($D$2:$D$21<>""),1/COUNTIFS($A$2:$A$21,"Potato",$B$2:$B$21,"<>"&"Mashed",$C$2:$C$21,"*"&$F$2&"*",$D$2:$D$21,"<>"&"",$D$2:$D$21,$D$2:$D$21),0))