简体   繁体   English

Excel:使用其他列中的条件计算列中的不同值

[英]Excel: Count distinct values in a column using criteria from other columns

I'm making a table to summarize a much larger table and I need to count the number of values from a column using criteria that can be found in another. 我正在制作一个表来汇总一个更大的表,我需要使用可以在另一个表中找到的条件来计算一列的值数量。

My data table looks for projects done look something like this: 我的数据表查找完成的项目,如下所示:

|Project ID|Date|Person|Value|

The problem is, there are duplicate Project IDs because of multiple people that work on a specific project and countifs doesn't seem to work well here since it counts the duplicate values. 问题在于,存在重复的项目ID,因为多个人在一个特定的项目上工作,而countif在这里似乎无法正常工作,因为它会计算重复的值。

I'm trying to make a summary table where I have a distinct count of unique IDs based on the date. 我正在尝试制作一个汇总表,其中基于日期我有不同数量的唯一ID。

|Date|Number of Unique IDs|

I found this answer here on stackexchange and was wondering if it can be done in excel? 我在stackexchange上找到了这个答案,想知道是否可以在excel中完成?

SQL: Count distinct values from one column based on multiple criteria in other columns SQL:根据其他列中的多个条件来计算一列中的不同值

You could use FREQUENCY to count the number of times a value occurs in a range so it can be done in Excel. 您可以使用FREQUENCY来计算一个值在一个范围内出现的次数,因此可以在Excel中完成。 This formula for example will count the number of different alphanumeric values present in the range A1:A10. 例如,此公式将计算范围A1:A10中存在的不同字母数字值的数量。

You could change this a little and use it in combination with the date to give you the summary you need. 您可以对此稍作更改,然后将其与日期结合使用,以提供所需的摘要。

=SUM(IF(FREQUENCY(MATCH(A1:A10,A1:A10,0),MATCH(A1:A10,A1:A10,0))>0,1))

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

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