问题
I thought I was a decent Sheets jockey, but here's a toughie. I'd like to turn the left into the right using just a formula
Sample also at: https://docs.google.com/spreadsheets/d/1JgDZOV_K7SbOrCb27Z5K2XUBcrtq99GTCa3-BM2pOD0
The closest I found was this (Separating Comma List into Cells with Formula) but it doesn't also do the matching.
回答1:
alternative by @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"))
回答2:
=ARRAYFORMULA(TRIM(SPLIT(TRANSPOSE(SPLIT(QUERY(TRANSPOSE(QUERY(TRANSPOSE(
IF(IFERROR(SPLIT(B1:B, ","))<>"", "♠"&A1:A&"♦"&SPLIT(B1:B, ","), ))
,,999^99)),,999^99), "♠")), "♦")))
来源:https://stackoverflow.com/questions/57593084/comma-separated-list-into-matched-columns-pairings