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

Compare text in Excel columns and then assign corresponding value to specific column

我在 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 进行匹配,我必须从 column D 复制相应的 ID 并将其放入 column C。为了快速了解,我手动在 column C 中输入了一些值。

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

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

这将 return 一个索引,作为 D1:D19 范围内的一个单元格。它首先会在 F1:F19 范围内寻找匹配单元格 B1 的值,并获取该行,然后在 Index() 到 return 中使用该行值。

编辑:如果出现错误,您可以将其包装在 Iferror() 函数中以输出一些文本。 IE。 =IfError(INDEX($D:$D,MATCH($B1,$F:$F,0)), $B1 & " not found")

Edit2:如果它们具有可比性,我为什么不使用 vlookup?因为您当前布置数据的方式并不能真正允许它(无论如何很容易)。尝试自己设置它,您会看到:=Vlookup(B1,d1:F19,1)...没有意义。您需要先重新排列数据,然后将 D 列数字放入 G,然后这个就可以了:=VLOOKUP(B1,F1:G19,2,FALSE)