VLOOKUP alternative using three lookup values

五迷三道 提交于 2019-12-02 18:13:34

问题


As you know Excel only lets you use one lookup value, but I need to compare three lookup values to find a fourth value.

For example in the screenshot below I want to use the information name, pet and business to find who the teacher is on the second sheet. For the record this is just example data to understand how to perform the task and I need to apply this to over 600 rows!

First sheet: Here is the first sheet

Second sheet: Here is my second sheet

Edit: I keep getting an error when I try to enter this formula: =index(Sheet2!A2:G7,MATCH(Sheet1!A5&Sheet!C5&Sheet1!D5,Sheet2!B2:B7&Sheet2!D2:D7&Sheet2!E2:E7,0))


回答1:


Instead of Vlookup(), you can use Index/Match, which is a nice alternative that lets you do this.

The formula correctly returns "Miss Smith": Note: This is entered as an array formula with CTRL+SHIFT+ENTER

So, the basic layout of the formula is: =Index([range to return],match([single look up value],[range where that value would be],0))

You can combine lookup values by concatenating them, as you can see in the screenshot. So, the single lookup values are A2, C2, and D2. And, you'd expect to find "Sarah" in the range G2:G3, "Dog" in H2:H3, etc.

Please let me know if I can clarify anything.

Edit: To help visualize the two sheets thing. I put the table (which you will lookup from) on a sheet called "Data Sheet". The table we need to complete is on "Main WS".

Here's "Main WS":

and the "Data Sheet":




回答2:


Given the cyclic calulation and disregard for the Worksheet.UsedRange property that the AGGREGATE function exhibits, you will want to cut down the ranges for the lookups to the minimmum required. Pick a column that will typically determine the extent of the lookup range and use that to define the end point of each lookup column.

Sheet2:

        

Sheet1:

        

The formula in Sheet1!E2 is,

        

Fill down as necessary.



来源:https://stackoverflow.com/questions/33784228/vlookup-alternative-using-three-lookup-values

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