使用条件计算唯一值 [英] Count Unique values with a condition

查看:27
本文介绍了使用条件计算唯一值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 A 列中,我列出了不同的名称.在 B 列中,我的值为 0 或 1.

In column A I have list of different names. In column B, I have values either 0 or 1.

我想从 A 列中获取所有在 B 列中具有 1 的唯一名称的计数.

使用下面的数组公式,我可以计算唯一的名称,但不能在 B 列上应用条件.

Using below array formula I am able count unique names but not able to apply condition on column B.

=SUM(1/COUNTIF(A:A,A:A))

推荐答案

假设不超过 100 行,试试这个数组公式"来计算 A2:A100 中不同的名字,其中有 1在 B2:B100 的同一行中:

Assuming no more than 100 rows try this "array formula" to count the different names in A2:A100 where there is a 1 in the same row in B2:B100:

=SUM(IF(FREQUENCY(IF(B2:B100=1,IF(A2:A100<>"",MATCH(A2:A100,A2:A100,0)),ROW(A2:A100)-ROW(A2)+1),1))

通过CTRL+SHIFT+ENTER

请注意,我说的是不同而不是唯一,因为两者不相同

Note that I say different not unique as the two are not the same

这篇关于使用条件计算唯一值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆