[英]How to count unique values from different named Excel table with conditions using array formula?
I have two tables (One that is used to capture every record, the other for capturing a summary of the records). 我有两个表(一个表用于捕获每个记录,另一个表用于捕获记录的摘要)。
Tracker Table - Columns: Code, Date, Error Message 跟踪器表 -列:代码,日期,错误消息
Summary Table - Columns: Code, Errors Count, Unique Errors 摘要表 -列:代码,错误计数,唯一错误
Currently, I use the following to retrieve the number of errors total from each app code in the Errors Count column: {=COUNT(IF([@Code]=Tracker[Code],1))}
目前,我使用以下代码从“错误计数”列中的每个应用程序代码中检索错误总数: {=COUNT(IF([@Code]=Tracker[Code],1))}
ie If I have the following in the Tracker Table : 即如果我在跟踪表中有以下内容:
1234 | Dec 01 34 | Error 1111 has occurred in Application 1234
1234 | Dec 23 34 | Error 1111 has occurred in Application 1234
1234 | Dec 23 34 | Error 4444 has occurred in Application 1234
Then in the Summary Table I should have: 然后,在摘要表中,我应该具有:
1234 | 3 | 2
I had a look at this answer (below formula), I can target the column in named table for the ranges ( B2:B100
, A2:A100
), but I don't know what to use for the ROW(A2)
target. 我看了一下这个答案 (在公式下方),我可以将命名表中的列作为范围( B2:B100
, A2:A100
)的目标,但我不知道该对ROW(A2)
目标使用什么。
=SUM(IF(FREQUENCY(IF(B2:B100=1,IF(A2:A100<>"",MATCH(A2:A100,A2:A100,0))),ROW(A2:A100)-ROW(A2)+1),1))
What array formula do I use to find the unique number of each error? 我使用什么数组公式来查找每个错误的唯一编号?
You can use this array formula: 您可以使用以下数组公式:
=SUM(IFERROR(([@Code]=Tracker[Code])/COUNTIFS(Tracker[Error Message],Tracker[Error Message],Tracker[Code],[@Code]),0))
The basic approach is to divide 1 buy the number of times a certain Error Message
appears and then SUM
those... This will give you the unique number of messages. 基本方法是将1购买某条Error Message
出现的次数,然后SUM
这些次数的SUM
。。。这将为您提供独特的消息数量。
We add in the initial [@Code]=Tracker[Code]
so that we get a 1
or 0
to for the numerator (ie ignore those rows that don't match the Code
) as well as the extra COUNTIFS
condition ...,Tracker[Code],[@Code]
so that we only count the occurrences of the Error Message
with the matching Code
我们添加初始的[@Code]=Tracker[Code]
以便为分子得到1
或0
(即忽略那些与Code
不匹配的行)以及额外的COUNTIFS
条件...,Tracker[Code],[@Code]
以便我们仅计算Error Message
与匹配Code
的出现次数
The IFERROR
is to get rid of those pesky #DIV/0!
IFERROR
是摆脱那些讨厌的#DIV/0!
errors for the unmatched rows... 错误的不匹配的行...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.