简体   繁体   English

Excel公式比较两列名称并将匹配的名称放在相邻的单元格中?

[英]Excel formula to compare two columns of names and put the matching ones in adjacent cells?

I have two columns with names.我有两列名称。 I want to find the matching names in the two columns and put them in cells next to each other.我想在两列中找到匹配的名称并将它们放在彼此相邻的单元格中。 How can I do that?我怎样才能做到这一点?

Try, in cell C1 :尝试,在单元格 C1 中:

IF(A1=B1,True,False)

this does assume a 1:1 equivalence of the two columns... Or这确实假设两列的 1:1 等价......或者

=IFERROR(MATCH(A1,B$1:B$10,0),"")

this will find the contents of A1 in cells B1:B10 and they don't need to be sorted.这将在单元格 B1:B10 中找到 A1 的内容,并且不需要对它们进行排序。 If the object is not there then the result is blank, if it is there then the result is the position of the item in the list.如果对象不存在,则结果为空,如果存在,则结果为项目在列表中的位置。

This will put the matched value:这将放置匹配的值:

IFERROR(INDEX(B$1:B$10,MATCH(A1,B$1:B$10,0)),"")

All can be dragged down...都可以拖下...

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

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