我正在尝试使用此QUERY
:
=IFERROR(TRANSPOSE(QUERY(Items!$A$2:$D,"SELECT D WHERE A = '"&A2&"' and B = '"&B2&"' and C = '"&C2&"' and C is not NULL and D is not NULL", 0)),)
将其转换为公式,我可以在工作表顶部输入一次,并将其应用于以下列中的所有单元格。
我已经尝试处理在SO上找到/收到的其他各种公式和答案,但是除了错误什么都没有。
答案 0 :(得分:1)
=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)))
答案 1 :(得分: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)))