Excel公式-将第二列的值与第三列对应

时间:2018-12-18 16:10:41

标签: excel excel-formula

我在excel电子表格中有以下数据

customer_id  old_customer_id    parent_id
ACF00408     ALL02364           1819
ADA00856     ALT00420           1824
ALT00420                        1829
ALL02364     ADA00856           1834
ALL00523                        1839
AME02272     ACF00408           28921

如何映射列customer_id和old_customer_id以获得相关的parent_id,如下所示

例如,如果在ACF00408customer_id中都找到old_customer_id,则其parent_id应该是28921而不是1819

customer_id  parent_id
ACF00408     28921
ADA00856     1834
ALT00420     1824
ALL02364     1819
ALL00523     
AME02272

尝试使用= VLOOKUP($ A2,$ B $ 2:$ C $ whatever,2,0)但不起作用

1 个答案:

答案 0 :(得分:0)

您可以使用COUNTIF()Index/Match

=IF(COUNTIF($A$2:$A$7,F2)+COUNTIF($B$2:$B$7,F2)=2,INDEX($C$2:$C$7,MATCH(F2,$B$2:$B$7,0)),"")

enter image description here