逗号分隔的列表成匹配的列配对

时间:2019-08-21 13:42:44

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

我以为自己是个正派的床单骑师,但这是个强硬派。我只想使用公式将左侧变成右侧

snap

也可以在https://docs.google.com/spreadsheets/d/1JgDZOV_K7SbOrCb27Z5K2XUBcrtq99GTCa3-BM2pOD0

进行采样

我找到的最接近的是这个(Separating Comma List into Cells with Formula),但它也没有匹配。

2 个答案:

答案 0 :(得分:0)

=ARRAYFORMULA(TRIM(SPLIT(TRANSPOSE(SPLIT(QUERY(TRANSPOSE(QUERY(TRANSPOSE(
 IF(IFERROR(SPLIT(B1:B, ","))<>"", "♠"&A1:A&"♦"&SPLIT(B1:B, ","), ))
 ,,999^99)),,999^99), "♠")), "♦")))

0

答案 1 :(得分:0)

@Matt:King替代:

=ARRAYFORMULA(QUERY(VLOOKUP(SEQUENCE(COUNTA(A2:A)*
 COLUMNS(SPLIT(B2:B, ",")), 1, 0)/ COLUMNS(SPLIT(B2:B, ","))+2,
 {ROW(A:A), A:A, TRIM(SPLIT(B:B, ","))}, MOD(SEQUENCE(COUNTA(A2:A)*
 COLUMNS(SPLIT(B2:B, ",")), 1, 0), COLUMNS(SPLIT(B2:B, ",")))*{0, 1}+{2, 3}),
 "where Col2 is not NULL"))

0