计算两列之间的匹配 [英] Count matches between two columns
本文介绍了计算两列之间的匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Excel中,我有两列。一个是预测,一个是结果。我想计算预测与结果匹配的次数(即正确预测)。
In Excel, I have two columns. One is a prediction, one is the result. I want to count how many times the prediction matches the result (i.e. a correct prediction).
数据如下所示:
Col A Col B
Bears Bears
Chiefs Raiders
Chargers Chargers
Colts Texans
Lions
Packers
所以我想通过公式获得的号码是 2 ,因为那是几场比赛(熊和充电器)。请记住,匹配必须在同一行中。
So the number I want to get to via a formula is 2, since that's how many matches there were (Bears and Chargers). Keep in mind the match has to be in the same row.
谢谢。
推荐答案
=SUMPRODUCT(--(A1:A6=B1:B6))
双重否定将分别将TRUE和FALSE转换为1和0,然后将它们相加。
The double negative will convert the TRUEs and FALSEs to 1s and 0s, respectively, then sum them up.
这篇关于计算两列之间的匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文