Google表格arrayformula vlookup转置匹配值并在另一张表格中返回所有唯一值

时间:2019-08-23 07:49:15

标签: google-sheets google-sheets-formula array-formulas google-sheets-query gs-vlookup

我需要一个arrayformula在另一个工作表中查找所有匹配的单元格,然后转置并返回所有对应的唯一值。

这是我的床单:

https://docs.google.com/spreadsheets/d/1uqeM6M9MAPehgyqyRLmH9mgg3Jh_RUSxADMisarht5Y/edit?usp=sharing

我已经尝试过了,但是不起作用:

=ARRAYFORMULA(IFERROR(VLOOKUP(TRANSPOSE(A2:A), Sheet2!A2:B, 2, 0)))

1 个答案:

答案 0 :(得分:0)

=ARRAYFORMULA(IFERROR(VLOOKUP(A2:A, 
 {SORT(UNIQUE(INDIRECT("Sheet2!A2:A"&COUNTA(Sheet2!A2:A)+1))), 
 SPLIT(TRIM(TRANSPOSE(QUERY(TRANSPOSE(IF(ISNUMBER(QUERY(QUERY(UNIQUE(Sheet2!A2:B), 
 "select count(Col1) where Col1 is not null group by Col1 pivot Col2", 0), "offset 1", 0)), 
 "♦"&QUERY(UNIQUE(Sheet2!A2:B), 
 "select count(Col1) where Col1 is not null group by Col1 pivot Col2 limit 0", 0), ))
 ,,999^99))), "♦")}, {1,2,3,4,5,6}, 0))

0