VLookUp value to another worksheet

时光怂恿深爱的人放手 提交于 2019-12-25 18:37:33

问题


I need to get the value of the corresponding item in Lookup table. But, I am getting N/A in my output. In worksheet1, I need to use column H as a lookup value then reference it in VLookup sheet or Table2 using ColumnC, the corresponding value should get the value in ColumnD. I used this code:

=VLOOKUP(H2, Table2, 4, FALSE)

Is there something wrong in my code?

Sample value:

Screenshot for Sheet1:

Screenshot for VLookup


回答1:


Correct your vlookup to :

=VLOOKUP(H2,C2:D128,2, FALSE)

Or define Table3 as c2:D128... and:

=VLOOKUP(H2, Table3, 4, FALSE)

To go the index & match route and it does have advantages, that the data does not have to be in the same area or even on the same sheet, I would suggest:

=index(sheet_name!D2:D128,MATCH(H2,sheet_name!C2:C128,0))

You can see the ranges defined in comparison to the vlookup, ie column D has the result, Column C the target... See:




回答2:


VLOOKUP always looks in the first column of the lookup_range. It then return the corresponding value from the column to the right identified by column_num. If you aren't trying to find something in the first column then you need an INDEX/MATCH pair instead.

=index(table2[legend], match(h2, table2[function], 0))

You do not need to add the worksheet names if Table2 is a structured table. Table2 is a unique identifier and can be referenced across worksheets.




回答3:


Try using the formula VLOOKUP(H2, 'Sheetname'!$C:$D,2, FALSE). Your formula will not work because the column(Column C in your case) that you are using to lookup the value is not the left most.



来源:https://stackoverflow.com/questions/53747752/vlookup-value-to-another-worksheet

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