Lookup using table with separated columns

我们两清 提交于 2019-12-10 12:35:10

问题


I would like to use VLOOKUP() using a table input consisting of columns that are not next to each other.

Example

MyCell = VLOOKUP(A1, MyTable, 2, FALSE)
MyTable = B1:B10 and D1:D10

Is there a way of making this operation work using a lookup function or any other worksheet function? Now I get an error.

Thanks in advance.

Edit: It's because the table is very large and I'm afraid that the operation will slow down the application if I use the entire table as input


回答1:


=INDEX(D1:D10,match(A1,B1:B10,0))

index/match is typically more efficient than vlookup anyway. if you really want VLOOKUP for just those columns you can use

=VLOOKUP(A1,CHOOSE({1,2},B1:B10,D1:D10),2,FALSE)



回答2:


In Google Sheets you can use array literals to concatenate two columns:

= VLOOKUP(A1, {B1:B10,D1:D10}, 2, FALSE)



来源:https://stackoverflow.com/questions/17403523/lookup-using-table-with-separated-columns

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