搜索 2 列和 return 转置行中的所有匹配项

Search 2 columns and return all matches in a transposed row

我正在尝试接受这个 QUERY:

=IFERROR(TRANSPOSE(QUERY(Items!$A:$D,"SELECT D WHERE A = '"&A2&"' and B = '"&B2&"' and C = '"&C2&"' and C is not NULL and D is not NULL", 0)),)

然后将它变成一个公式,我可以在 sheet 的顶部输入一次,并将其应用于下面一列中的所有单元格。

我已经尝试操纵我在 SO 上 found/received 的各种其他公式和答案,但除了错误之外一无所获。

My sheet

=ARRAYFORMULA(IFERROR(VLOOKUP(Estimate!A2:A&Estimate!B2:B, 
 TRIM(IFERROR(SPLIT(TRIM(TRANSPOSE(QUERY(TRANSPOSE(
 {INDEX(QUERY(IFERROR(SPLIT(SORT(UNIQUE(IF((LEN(Items!A2:A&Items!B2:B))*(LEN(Items!C2:C)),
 Items!A2:A&Items!B2:B&"♦"&Items!C2:C, )), 1, 1), "♦")), 
 "select Col1,count(Col1) where Col1 is not null group by Col1 pivot Col2", 0),,1), IF(
 ISNUMBER(QUERY(IFERROR(SPLIT(SORT(UNIQUE(IF((LEN(Items!A2:A&Items!B2:B))*(LEN(Items!C2:C)),
 Items!A2:A&Items!B2:B&"♦"&Items!C2:C, )), 1, 1), "♦")), 
 "select count(Col1) where Col1 is not null group by Col1 pivot Col2", 0)),
 QUERY(IFERROR(SPLIT(SORT(UNIQUE(IF((LEN(Items!A2:A&Items!B2:B))*(LEN(Items!C2:C)), 
 Items!A2:A&Items!B2:B&"♦♥"&Items!C2:C, )), 1, 1), "♦")),
 "select count(Col1) where Col1 is not null group by Col1 pivot Col2 limit 0", 0), )})
 ,,999^99))), "♥"))), {2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}, 0)))

感谢您提供如此庞大的公式!并认为我正在尝试使用简单的 FILTER 来完成此操作。这是否适合在搜索条件中包含另一列(C 列)?

=ARRAYFORMULA(IFERROR(VLOOKUP('task-itemAssociationsDV'!A2:A&'task-itemAssociationsDV'!B2:B&'task-itemAssociationsDV'!C2:C, 
 TRIM(IFERROR(SPLIT(TRIM(TRANSPOSE(QUERY(TRANSPOSE(
 {INDEX(QUERY(IFERROR(SPLIT(SORT(UNIQUE(IF((LEN(taskData!A2:A&taskData!B2:B&taskData!C2:C))*(LEN(taskData!D2:D)), 
 taskData!A2:A&taskData!B2:B&taskData!C2:C&"♦"&taskData!D2:D, )), 1, 1), "♦")), 
 "select Col1,count(Col1) where Col1 is not null group by Col1 pivot Col2", 0),,1), IF(
 ISNUMBER(QUERY(IFERROR(SPLIT(SORT(UNIQUE(IF((LEN(taskData!A2:A&taskData!B2:B&taskData!C2:C))*(LEN(taskData!D2:D)), 
 taskData!A2:A&taskData!B2:B&taskData!C2:C&"♦"&taskData!D2:D, )), 1, 1), "♦")), 
 "select count(Col1) where Col1 is not null group by Col1 pivot Col2", 0)),
 QUERY(IFERROR(SPLIT(SORT(UNIQUE(IF((LEN(taskData!A2:A&taskData!B2:B&taskData!C2:C))*(LEN(taskData!D2:D)), 
 taskData!A2:A&taskData!B2:B&taskData!C2:C&"♦♥"&taskData!D2:D, )), 1, 1), "♦")),
 "select count(Col1) where Col1 is not null group by Col1 pivot Col2 limit 0", 0), )})
 ,,999^99))), "♥"))), {2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}, 0)))