VLOOKUP to the left from another sheet in Google Sheets

做~自己de王妃 提交于 2019-12-13 03:54:48

问题


I have a spreadsheet that is managed externally to my own spreadsheet in Google Sheets. I am trying to pull in data to my sheet from that external sheet so I have a centralized location to display task items that pertain to me. Here is the formula that I thought would work:

=VLOOKUP("My Name", IMPORTRANGE("https://linkto.othersheet.com", {"Tab1!$G$1:$G$999","Tab2!$A$1:$A$999"}),2,FALSE)

The formula should use IMPORTRANGE to pull in 2 of the columns (or multiple columns) from the external sheet. Then do a VLOOKUP based on "My Name", find any matches in column G and reply with the value in the corresponding column A.

If I set the index to 1, it returns the value of column G just fine. If I set the index to 2, it gives me an out of bounds error. I also want it to show all results, not just the first one. So if there are multiple results that match, I want all of the results to show in a row separately.

EDIT:

Here is an example sheet for the formula work: https://docs.google.com/spreadsheets/d/13R5VEv3cyZ3vJgb2S90xDxvpXyVV38yZXO8zIAd9OR4/edit?usp=sharing

Here is the example sheet for the external source data: https://docs.google.com/spreadsheets/d/13P-nNONZuesnmByZCp6-zmIyMVJpm__nvsz3w-ItwtQ/edit?usp=sharing


回答1:


not sure why you need VLOOKUP tho...

=QUERY(IMPORTRANGE("13P-nNONZuesnmByZCp6-zmIyMVJpm__nvsz3w-ItwtQ", "Sheet1!A2:E"), 
 "select Col1,Col2 where Col4 = 'Engineer'")



来源:https://stackoverflow.com/questions/56064287/vlookup-to-the-left-from-another-sheet-in-google-sheets

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