我想修改以下QUERY
或完成相同结果的某些公式变量,使其仅在列顶部输入一次,并使用ARRAYFORMULA
填充下面的单元格
=IFERROR(QUERY(Items!$A$2:$T,"SELECT E,F,G,H,I,J,K,L,M,N,O,P,Q,R where A = '"&Estimate!A2&"' and B = '"&Estimate!B2&"' and C = '"&Estimate!C2&"' "&if(Estimate!D2<>"", "and D = '"&Estimate!D2&"'",)&" AND A is not null LIMIT 1", 0),"")
我的公式在my spreadsheet的Estimate!G2中。
答案 0 :(得分:2)
我认为您必须使用Vlookup,它不如Query方便。到目前为止,这是我所拥有的,但是在所有情况下(与查询中的ORDER语句有关),要获得与查询完全相同的结果可能需要更多的工作:
=ArrayFormula(if(A2:A="","",vlookup(A2:A&B2:B&C2:C&if(D2:D="","*",D2:D),{Items!A2:A&Items!B2:B&Items!C2:C&Items!D2:D,Items!A2:T},{2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21},false)))
答案 1 :(得分:2)
this answer非常正确,确切的公式是:
=ARRAYFORMULA(IF(LEN(A2:A), VLOOKUP(A2:A&B2:B&C2:C&IF(LEN(D2:D), D2:D, "*"),
{Items!A2:A&Items!B2:B&Items!C2:C&Items!D2:D,Items!A2:T},
{6,7,8,9,10,11,12,13,14,15,16,17,18,19}, 0), ))