Vlookup找到匹配

时间:2016-09-02 11:11:18

标签: excel

我想用我的ID获取匹配的字符串,我想用VLOOKUP来实现它

=VLOOKUP(L2;Tree_Matchingnode!A:B;1;0)

我正在做Vlookup的表看起来像这样:

+----------------+------------------+
| Parent_TREE_ID | Parent_TREE_NAME |
+----------------+------------------+
|              1 |                  |
|              2 |                  |
|              3 |                  |
+----------------+------------------+

“匹配”表格如下所示:

+-------------+----+
| Folder_PATH | ID |
+-------------+----+
| Path1       |  1 |
| Path3       |  9 |
| Path15      |  3 |
+-------------+----+

我的结果应该是第一个表中的ID与来自第二个表的正确路径相匹配

我得到的结果是#N / A错误,L2将是Parent_TREE_ID

1 个答案:

答案 0 :(得分:1)

您只能使用VLOOKUP而不是左侧获取右侧的列。而是使用INDEX-MATCH,因为它更灵活:

而不是:

=VLOOKUP(L2;Tree_Matchingnode!A:B;1;0)

使用类似:

=INDEX(Tree_Matchingnode!A:A,MATCH(L2,Tree_Matchingnode!B:B,0),1)