Google Sheets VLOOKUP of multiple columns across multiple sheets

对着背影说爱祢 提交于 2019-12-11 08:11:25

问题


I am not 100% sure VLOOKUP is the correct formula to use for this, but what I was trying was the following:

=ArrayFormula(IF(len(B2:B),vlookup(B2:B,{‘New1′!B3:C;’New2′!B3:C;’New3’!B3:C},2,FALSE),””))

I wanted to modify the above formula to do the following. I have a Google Sheet with multiple tabs. There is a single tab that has all of the data stored as metadata to populate the other 6 tabs. I am splitting the metadata into the 6 tabs, but want to avoid duplicating the data in the tabs. So I wanted to create a column that would show me where the data is currently placed if it is placed already. Here is an example:

Master Sheet has this data:

Name1, Phone1, Address1, E-mail1 
Name2, Phone2, Address2, E-mail2
Name3, Phone3, Address3, E-mail3 
Name4, Phone4, Address4, E-mail4

There will be 4 tabs where I have the same columns (Name, Phone, Address, E-mail). I will be splitting the data in the master sheet to these 4 tabs. If I place "Name2, Phone2, Address2, E-mail2" in Tab 3: I want the formula to see the entire chunk of data in the VLOOKUP, not just the name, and if it does, to display "Tab 3" in the field. There is metadata that has the same name or address, so I want the VLOOKUP to look across multiple tabs (Tab 1, Tab 2, Tab 3, Tab 4) and compare against multiple columns to match (Name, Phone, Address, E-mail are all the same as the ones in the master sheet) and if it finds that match...it will display some sort of indication of the tab it is on ("Tab 3"). Hopefully, this makes sense.


回答1:


=ARRAYFORMULA(IFERROR(SUBSTITUTE(SPLIT(TRIM(
    TRANSPOSE(QUERY(TRANSPOSE(SUBSTITUTE(IF(LEN(A2:A), {
 IF(TRANSPOSE(QUERY(TRANSPOSE(A2:D),,999^99))=IFERROR(VLOOKUP(
    TRANSPOSE(QUERY(TRANSPOSE(A2:D),,999^99)),
    TRANSPOSE(QUERY(TRANSPOSE(Sheet1!A2:D),,999^99)),1,0)), "Sheet1", ),
 IF(TRANSPOSE(QUERY(TRANSPOSE(A2:D),,999^99))=IFERROR(VLOOKUP(
    TRANSPOSE(QUERY(TRANSPOSE(A2:D),,999^99)),
    TRANSPOSE(QUERY(TRANSPOSE(Sheet2!A2:D),,999^99)),1,0)), "Sheet2", ),
 IF(TRANSPOSE(QUERY(TRANSPOSE(A2:D),,999^99))=IFERROR(VLOOKUP(
    TRANSPOSE(QUERY(TRANSPOSE(A2:D),,999^99)),
    TRANSPOSE(QUERY(TRANSPOSE(Sheet3!A2:D),,999^99)),1,0)), "Sheet3", ),
 IF(TRANSPOSE(QUERY(TRANSPOSE(A2:D),,999^99))=IFERROR(VLOOKUP(
    TRANSPOSE(QUERY(TRANSPOSE(A2:D),,999^99)),
    TRANSPOSE(QUERY(TRANSPOSE(Sheet4!A2:D),,999^99)),1,0)), "Sheet4", )}, ),
 " ", "♦")),,999^99))), " "), "♦", " ")))



来源:https://stackoverflow.com/questions/55874523/google-sheets-vlookup-of-multiple-columns-across-multiple-sheets

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