简体   繁体   English

与条件不同的计数

[英]Distinct count with conditions

I am referring to the following post : Excel distinct count with conditions 我指的是以下帖子: 带条件的Excel唯一计数

I would like to do the same thing that has been asked and answered by user Chris Neilsen, however there is a little twist. 我想做与用户Chris Neilsen要求和回答的相同的事情,但是有一点曲折。

A                 
sp24679999        
sp24661009        
sp24661003        
sp24660009        
sp24660003        
1231244545        
1231244545       

B
YES
YES
NO
YES
NO
NO
NO 

I would like to count how many different values there are in column A containing "NO" in column B. The problem here is that there are not only values in column A, but there is also text. 我想计算A列中有多少个不同的值,其中B列中包含“否”。这里的问题是,A列中不仅有值,而且还有文本。 Here answer should be 3 这里的答案应该是3

Any help would be GREATLY appreciated 任何帮助将不胜感激
Thank you very much 非常感谢你

I don't think it will be easy to use the FREQUENCY formula here because you have text. 我认为在这里使用FREQUENCY公式并不容易,因为您有文字。

Here is a try in another way: 这是另一种尝试:

{=SUM(IF(B1:B15="NO",IF(COUNTIFS(A1:A15,A1:A15,B1:B15,"NO")>1,1/COUNTIFS(A1:A15,A1:A15,B1:B15,"NO"),1),0))}

[EDIT] French version (as the OP has a french version of Excel) [编辑]法语版本(因为OP具有法语的Excel版本)

=SOMME(SI(B1:B15="NO";SI(NB.SI.ENS(A1:A15;A1:A15;B1:B15;"NO")>1;1/NB.SI.ENS(A1:A15;A1:A15;B1:B15;"NO");1);0))

Validate as an array formula with Ctrl + Shift + Enter 使用Ctrl + Shift + Enter键验证为数组公式

The formula will count for a total of 1 each couple of unique in col A / "NO" in col B, and 1 if there is only one couple. 该公式将在A列中每对唯一的夫妇计算为1,在B列中为“否”,如果只有一对,则计算为1。

I've tested if on a sample of data. 我已经对数据样本进行了测试。

I hope I didn't mess up my formula translation. 我希望我不要弄乱我的公式翻译。 Please tell me if anything goes wrong. 请告诉我是否有问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM