如何在Excel中计数唯一的值有两个条件 [英] How to count unique values in Excel with two conditions
问题描述
我知道已经有一个问题已经被解决了关于统计单一条件(计数具有条件的唯一值),但是我想知道如何在具有两个条件的列中计数uniquise。
I know there is already a question that has been answered about counting uniques with a condition (Count Unique values with a condition), but I want to know how to count uniques in a column with TWO conditions.
我有一个数据集与创建地点的日期以及城市。每个位置都有一个拥有者,有时一个拥有者可以有多个位置,所以我想按城市和月份计数唯一的所有者(两者都已经以列的形式存在)。
I have a dataset with dates of locations created as well as city. Each location has an owner and sometimes an owner can have multiple locations so I want to count unique owners by city and month (both already exist as columns).
这样做?
推荐答案
我在链接中建议的公式是这个
The formula I suggested in the link is this
= SUM(IF(频率(IF(B2:B100 = 1,IF(A2:A100<> 中,MATCH(A2:A100,A2:A100,0))),ROW (A2:A100)-ROW(A2)+1),1))
在中计算不同的值A2:A100
如果 B2:B100
= 1
您可以添加更多 IF
s具有更多条件,确保您在正确的位置获得必要的括号数,例如对于城市和月份的不同所有者的数量,尝试此版本为 3月
在芝加哥
You can just add more IF
s with more conditions, making sure you get the requisite number of parentheses in the correct locations, e.g. for the number of different owners by city and month try this version for March
in Chicago
= SUM(IF(FREQUENCY(IF(City =Chicago)IF(Month =March,IF(Owner<"所有者,0)))),ROW(所有者)-MIN(ROW(所有者))+ 1),1))
使用 CTRL + SHIFT + ENTER
这篇关于如何在Excel中计数唯一的值有两个条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!