Google 工作表转置、拆分、重复、保留空白

Google Sheets transpose, split, repeat, keeping blanks

我不知所措,在众多功能中迷失了方向。我有杂乱的数据,我已经设法接近我想要的位置,但无法对其进行微调。 https://docs.google.com/spreadsheets/d/1wXM8DowXjzCt8etP1qYo6SsA-egIlm-UOp8RnfCYv44/edit?usp=sharing Sheet 中的注释解释了我正在尝试做的大部分事情。

我已经用它来复制 Plant 列,但它也复制了以下列(不理想,但我可以接受)

=ArrayFormula(vlookup(transpose(split(query(rept(row(A2:E)&" ",J2:J),,9^9)," ")), {row(A2:E),A2:J},{2,3,4,5,6},0))

我在 Nums 和 Storage 列上试过这个:

=ArrayFormula(SUBSTITUTE(QUERY(FLATTEN(TRIM(SPLIT(FILTER(F2:F&";*", F2:F<>""), ";", 0, 1))), "Select Col1 Where Col1 <> ''"), "*",, ))

但它在错误的位置添加了空格并扩展到太多行。似乎要添加额外的空格。

这可能吗?

使用:

=ARRAYFORMULA({A1:I1; QUERY(REGEXREPLACE(""&SPLIT(FLATTEN(A2:A15&"×"&
 IF(IFERROR(SPLIT(G2:G15, ";"), "2♦"&G2:G15)="",, REGEXREPLACE(SEQUENCE(1, 20)&"♦"&IF(B2:B15="", "3♦"&B2:B15, B2:B15), "^1♦", ))&"×"&
 IF(IFERROR(SPLIT(G2:G15, ";"), "2♦"&G2:G15)="",, REGEXREPLACE(SEQUENCE(1, 20)&"♦"&IF(C2:C15="", "3♦"&C2:C15, C2:C15), "^1♦", ))&"×"&
 IF(IFERROR(SPLIT(G2:G15, ";"), "2♦"&G2:G15)="",, REGEXREPLACE(SEQUENCE(1, 20)&"♦"&IF(D2:D15="", "3♦"&D2:D15, D2:D15), "^1♦", ))&"×"&
 IF(IFERROR(SPLIT(G2:G15, ";"), "2♦"&G2:G15)="",, REGEXREPLACE(SEQUENCE(1, 20)&"♦"&IF(E2:E15="", "3♦"&E2:E15, E2:E15), "^1♦", ))&"×"&
 IFERROR(SPLIT(F2:F15, ";"), "4♦"&F2:F15)&"×"&IFERROR(SPLIT(G2:G15, ";"), "5♦"&G2:G15)&"×"&
 IF(IFERROR(SPLIT(G2:G15, ";"), "2♦"&G2:G15)="",, REGEXREPLACE(SEQUENCE(1, 20)&"♦"&IF(H2:H15="", "3♦"&H2:H15, H2:H15), "^1♦", ))&"×"&I2:I15), 
 "×"), ".*♦.*", ), "where Col9 is not null", 0)})


更新:

=ARRAYFORMULA({A1:I1; QUERY(REGEXREPLACE(""&SPLIT(FLATTEN(A2:A9&"×"&
 IF(IFERROR(SPLIT(G2:G9, ";"), "2♦"&G2:G9)="",, REGEXREPLACE(SEQUENCE(1, IFERROR(COLUMNS(SPLIT(G2:G9, ";")), 1))&"♦"&IF(B2:B9="", "3♦"&B2:B9, B2:B9), "^1♦", ))&"×"&
 IF(IFERROR(SPLIT(G2:G9, ";"), "2♦"&G2:G9)="",, REGEXREPLACE(SEQUENCE(1, IFERROR(COLUMNS(SPLIT(G2:G9, ";")), 1))&"♦"&IF(C2:C9="", "3♦"&C2:C9, C2:C9), "^1♦", ))&"×"&
 IF(IFERROR(SPLIT(G2:G9, ";"), "2♦"&G2:G9)="",, REGEXREPLACE(SEQUENCE(1, IFERROR(COLUMNS(SPLIT(G2:G9, ";")), 1))&"♦"&IF(D2:D9="", "3♦"&D2:D9, D2:D9), "^1♦", ))&"×"&
 IF(IFERROR(SPLIT(G2:G9, ";"), "2♦"&G2:G9)="",, REGEXREPLACE(SEQUENCE(1, IFERROR(COLUMNS(SPLIT(G2:G9, ";")), 1))&"♦"&IF(E2:E9="", "3♦"&E2:E9, E2:E9), "^1♦", ))&"×"&
 IFERROR(SPLIT(F2:F9, ";"), "4♦"&F2:F9)&"×"&IFERROR(SPLIT(G2:G9, ";"), "5♦"&G2:G9)&"×"&
 IF(IFERROR(SPLIT(G2:G9, ";"), "2♦"&G2:G9)="",, REGEXREPLACE(SEQUENCE(1, IFERROR(COLUMNS(SPLIT(G2:G9, ";")), 1))&"♦"&IF(H2:H9="", "3♦"&H2:H9, H2:H9), "^1♦", ))&"×"&I2:I9), 
 "×"), ".*♦.*", ), "where Col9 is not null", 0)})