VLOOKUP based on two column values

吃可爱长大的小学妹 提交于 2019-12-10 10:55:21

问题


I have a table with User IDs in one column. These are entered multiple times to show the result for a particular topic.

ID          Topic       Pass/Fail
71086686    Science     P
71086686    Maths       P
71086686    Tech        P
71086686    ICT         F
71086687    Science     P
71086687    Maths       P
71086687    Tech        P
71086687    ICT         F

I am trying to find a way to return the Pass/Fail result for a particular ID and topic.

I am trying to use VLOOKUP to do this but cant work out how to use multiple columns as values to look up against.

essentially i am trying to acheive the below:

Vloookup([ID] and [Topic], A:C, 3, FALSE)

回答1:


I don't recommend to concatenate criteria and searchranges when you could use INDEX & MATCH combo.

=INDEX(C2:C9,MATCH(1,(A2:A9=Criteria1)*(B2:B9=Criteria2),0))

And confirm through CtrlShiftEnter

Implement another INDEX if you want to remove the array entering:

=INDEX(C2:C9,MATCH(1,INDEX((A2:A9=Criteria1)*(B2:B9=Criteria2),0),0))



回答2:


You can add another column with a formula A2&B2, then use Vlookup to find that value.

Let's say you add it in the new column A.

Then your formula to find the value would look like this:

 Vloookup([ID] & [Topic], A:D, 4, FALSE)

I use this to quickly find values that I need without typing long formulas.



来源:https://stackoverflow.com/questions/57038224/vlookup-based-on-two-column-values

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