【发布时间】:2020-11-16 07:10:54
【问题描述】:
我有 2 列,它们的值是相互配对的(col1 是 A:A,col2 是 B:B):
col1 | col2
Harry Potter | Voldemort
Harry Potter | Draco Malfoy
Michael Corner| Draco Malfoy
Ernie Mac | Hannah Abbot
我想检查 col1 以查看列表 1 中是否存在此名称:
List1:
Harry Potter
Dumbledore
Ginny Weasley
Godric Gryffindor
我还想检查 col 2 以查看此名称是否存在于 List 2 中:
List2:
Salazar Slytherin
Draco Malfoy
Voldemort
Severus Snape
Vincent Crabbe
然后我想要 List1 中存在的 Col1 名称与 List2 中存在的 Col2 名称配对的次数。
这是我目前的尝试:
=arrayformula(sumproduct(if(isblank(A:A),0,1), if(isblank(B:B),0,1), if(A:A=List1,1,0), if(B:B=List2,1,0)))
但它不起作用。我怀疑 if(A:A=List1,1,0) 和 if (B:B=List2,1,0) 有问题。
基本上,我需要 col1 作为返回
1
1
0
0
col2 返回为
1
1
1
0
所以我可以总结它们。 最初,我尝试 countif col1 名称存在于 List1 中,但 countif 返回一个数字而不是数组,只是将 col1 计为 2。
【问题讨论】:
标签: arrays excel list array-formulas exists