简体   繁体   English

匹配A列和B列中的名称,然后计算C中的出现次数

[英]Match names in column A and B, then count occurrences in C

We have a scoring spreadsheet which tracks games played and the winner of each match. 我们有一个评分电子表格,可以跟踪比赛和每场比赛的胜利者。 We have the following columns 我们有以下专栏

  • column A (name1) A栏(名称1)
  • column B (vs) B栏(对比)
  • column C (name2) C列(名称2)
  • column D (winner name) D栏(获胜者名称)

I have used 我用过

=SUMPRODUCT((A:A="name1")*(C:C="name2")+(A:A="name2")*(C:C="name1"))

to count how many games this particular pairing have played, simply because as the games are entered by different people names are in either column. 计算这个特定配对玩了多少游戏,仅仅是因为游戏是由不同的人输入的,所以列在任一列中。

Now I need to find a way to count the amount wins from the games these two have played, obviously the formula above is redundant for this. 现在我需要找到一种方法来计算这两场比赛的胜利数量,显然上面的公式对此是多余的。

So in effect, match from column A and C name1 and name2 and count how many name1 exists in column D. 因此,实际上,匹配来自列A和C的name1name2并计算列D中存在多少个name1

It should be sufficient to count how many times Name1 exists in column D with Name2 in A or C so try either 在A或C中使用Name2计算Name1中存在的Name1的次数应该足够了,所以请尝试

=COUNTIFS(D:D,"Name1",A:A,"Name2")+COUNTIFS(D:D,"Name1",C:C,"Name2")

or you can use SUMPRODUCT like this 或者您可以像这样使用SUMPRODUCT

=SUMPRODUCT((D:D="Name1")*((A:A="Name2")+(C:C="Name2")))

The first one is longer but more efficient 第一个更长但效率更高

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

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