2017-06-19 95 views
0

我在excel中有以下列,我想根據匹配ID將ID列更改爲新ID,例如在ID列中第一個數據是Zrecruit_376840000000415007,即Zrecruit_376840000000415007 = 5789比賽ID和新的ID列的ID應及時更換,5789.基於Excel中的另一列填充值

ID        Match ID       New ID 
Zrecruit_376840000000415007  Zrecruit_376840000000367020 = 5782 
Zrecruit_376840000000215296  Zrecruit_376840000000375036 = 5783 
Zrecruit_376840000000217195  Zrecruit_376840000000389001 = 5784 
Zrecruit_376840000000218111  Zrecruit_376840000000369168 = 5785 
Zrecruit_376840000000219665  Zrecruit_376840000000392001 = 5786 
Zrecruit_376840000000222030  Zrecruit_376840000000410013 = 5787 
Zrecruit_376840000000226008  Zrecruit_376840000000432013 = 5788 
Zrecruit_376840000000227079  Zrecruit_376840000000415007 = 5789 

I have applied the formula as attached in the image but im getting N/A

回答

1

試試這個

=REPLACE(VLOOKUP(A2 & "*",$B$2:$B$9,1,0),1,FIND("=",VLOOKUP(A2 & "*",$B$2:$B$9,1,0),1)+3,"")這裏「+3 「表示」=「之後的三個空格。改變這種按您的要求

ID = Column A Matched ID = Column B New ID = Column C

粘貼此公式在列C

enter image description here

+0

如果在B列中找不到A2,則會發出#N/A錯誤。將該公式附加到所有行並查看。您也可以通過'CTRL + H'手動查找A2值 – Maddy

0

你可以寫一個公式來找到匹配的行數,並得到其相應的單元格值,類似於下面的東西

=INDIRECT(ADDRESS(MATCH(A2,B2:B9,0),3))

此公式:

  • 查找範圍B2 A2中的匹配的文本:B9
  • 獲取的地址與列行作爲3(或列C)
  • 獲取的值使用INDIRECT()函數的地址

這將使你在新列中的值,那麼你可以複製粘貼,你想,

或者,您也可以在VBA腳本中編寫類似的函數以直接替換值