我正在尝试创建一个计算重复条目一次的countifs公式。请参见下面的示例数据集。 “蔬菜”是细胞A1。
其中我试图计算马铃薯(A栏)受影响的KPI(未进行捣碎(B栏),数据1(C栏)中出现“1(ASS)”。 D列具有空白单元格和“N / A”,不能计数。 C列显示多选列表中的数据,并以逗号分隔。
我已输入公式来计算工作簿中单元格H2中的KPI总数(参见图片)。答案是3.我使用的公式是
= COUNTIFS($ A $ 3:$ A $ 22 “土豆”,$ B $ 3:$ B $ 22 “<>” 中&安培; “泥”,$ C $ 3:$ C $ 22“的 “&安培; $ F $ 3及””,$ d $ 3:$ d $ 22 “<>” 中&安培; “”,$ d $ 3:$ d $ 22 “<>” 中&安培; “N / A”)
但是,我无法创建任何可以计算受影响的唯一KPI数量的内容。通过唯一,我的意思是计算第一个实例/计数重复条目一次。 H3的答案应为2(再次见图)。
在我的数据集中,我可以根据需要创建一个新列,但是如果有办法只使用一个我喜欢的解决方案的公式来回答这个问题。
提前致谢。
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
答案 0 :(得分:0)
试试这个数组公式(请记住使用 Ctrl + Shift + 输入输入公式! !)
=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))
带通配符搜索的公式:
=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))
在单元格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))