当一列的数据包含CSV时,SPLIT QUERY结果分成不同的行

时间:2019-07-23 14:57:19

标签: google-sheets transpose google-sheets-formula array-formulas google-sheets-query

在此QUERY

=QUERY(QUERY(Estimate!A2:Y,"SELECT A,D,E,F,G,H,J,Y",0)

Y列包含CSV列表。如何在结果中将其分成多行?

我尝试了这个,但没有成功:

=QUERY(QUERY(Estimate!A2:Y,"SELECT A,D,E,F,G,H,J,'"&SPLIT(Estimate!Y2,", ",TRUE,TRUE)&"'",0),"OFFSET 1",0)

My sheet

1 个答案:

答案 0 :(得分:2)

=ARRAYFORMULA(TRIM(SUBSTITUTE(SPLIT(TRANSPOSE(QUERY(TRANSPOSE(QUERY(
 SUBSTITUTE(A2:C, " ", "♦"), "select Col1,Col2,Col3", 0)),, 999^99)), " ,"), "♦", " ")))

0


=ARRAYFORMULA(TRIM(SPLIT(TRANSPOSE(SPLIT(QUERY(TRANSPOSE(QUERY(TRANSPOSE(
 IF(IFERROR(SPLIT(C2:C, ","))<>"", "♦"&A2:A&"♠"&B2:B&"♠"&SPLIT(C2:C, ","), ))
 ,,999^99)),,999^99), "♦")), "♠")))

0