Excel列匹配然后选择列的id

时间:2014-05-19 09:44:51

标签: excel

我有问题,我无法解决。我需要通过匹配其他类似

来从一列中选择Preceding id
id  gname            id2     gname2
1   Cefaclor                 Cefaclor
2   Amlodipine               Cefaclor
3   Olmesartan               Cefaclor
4   Memantine                Amlodipine
                             Olmesartan
                             Olmesartan
                             Memantine

并输出如下

id  gname            id2     gname2
1   Cefaclor          1      Cefaclor
2   Amlodipine        1      Cefaclor
3   Olmesartan        1      Cefaclor
4   Memantine         2      Amlodipine
                      3      Olmesartan
                      3      Olmesartan
                      4      Memantine

1 个答案:

答案 0 :(得分:0)

这是一个示例公式,其布局如附图所示。您可以在C2中输入公式,并填写到C8。

您需要根据实际布局调整参考:

C2:  =INDEX($A$2:$A$5,MATCH(D2,$B$2:$B$5,0))

enter image description here