Match values from two tables in excel

女生的网名这么多〃 提交于 2019-12-25 18:29:06

问题


One table has policy numbers and the agent who wrote each policy. An agent's name multiple times.

Another table has just the policy numbers and I want to add the agents' names next to the numbers.

VLOOKUP doesn't work because the firs table shows the agents' names multiple times.

Any ideas how to do this?


回答1:


If the numbers are unique and only the Agents are duplicates, you can use Index/Match or Vlookup.
With Index / Match:

=IFERROR(INDEX(Policy!$B$2:$B$15,MATCH(A2,Policy!$A$2:$A$15,0)),"")

Policy is the sheet where you have Numbers (Column A, A2:A5)and corresponding Agent (Column B, B2:B15) change the references to correspond the last row but keep $ for fixed references. You can drag it down next to A2 where the numbers that you need to find their Agent are.

With Vlookup:

=IFERROR(VLOOKUP(A2,Policy!$A$2:$B$15,2,FALSE),"")

You can drag it down, next to A2 where the numbers are in the new sheet.
Also change Policy!$A$2:$B$15 to correspond the references of your Data.
2 to return the value from the second column (Agent)
False for exact match.



来源:https://stackoverflow.com/questions/44850530/match-values-from-two-tables-in-excel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!