比较Excel列中的文本,然后将相应的值分配给特定的列

我有一些Excel工作表中的值,即列B,D和E中的值是:

**B** **C** **D** **E** Cryptography 11 1 Applied Mathematics Machine Learning 23 2 Analysis of Algorithms Networks and Communication 26 3 Automata Theory Networks and Communication 26 4 Artificial Intelligence Robotics 30 5 Biological Networks Computer Graphics 10 6 Combinatorial Optimization Data Mining 12 7 Computability Theory Combinatorial Optimization 6 8 Computational Complexity Theory Applied Mathematics .. 9 Computer Vision Analysis of Algorithms .. 10 Computer Graphics Information Retrieval .. 11 Cryptography Artificial Intelligence .. 12 Data Mining Artificial Intelligence .. 13 Data Structures Programming Languages .. 14 Databases Data Mining .. 15 Digital Logic Cryptography .. 16 Distributed Computing Information Retrieval .. 17 Evolutionary Computation Machine Learning .. 18 Human Computer Interaction Machine Learning .. 19 Image Processing ... .. .. ... ... .. .. ... ... .. .. ... 

column C是空的。

现在我必须匹配column B值与column E ,匹配find的行,我必须从column D复制相应的ID并将其放置到column C 。 而我已经在column C手动设置了一些值,以便快速了解。

如果我理解正确,索引/匹配公式(比Vlookup更强大一点)应该可以正常工作:

=INDEX($D$1:$D$19,MATCH($B1,$F$1:$F$19,0)) 。 ENTER并向下拖动。 请注意,将数据范围的第19行更改为最后一行。

这将返回一个索引,是D1:D19范围内的一个单元格。 它会首先看到范围F1:F19与单元格B1的值相匹配,然后获取该行,然后使用Index()中的那一行返回该值。

编辑:你可以把它包装在Iferror()函数中输出一些文本,如果有错误。 Ie =IfError(INDEX($D$1:$D$19,MATCH($B1,$F$1:$F$19,0)), $B1 & " not found")

Edit2:为什么我不使用vlookup,如果它们是可比较的? 因为目前你的数据布局方式并不真正允许(反正很简单)。 尝试自己设置它,你会看到: =Vlookup(B1,d1:F19,1) …没有任何意义。 你需要先重新排列你的数据,然后把D列的数字放在G中,那么这个数据就可以工作: =VLOOKUP(B1,F1:G19,2,FALSE)