Comma separated list into matched columns pairings

 ̄綄美尐妖づ 提交于 2021-02-05 07:45:10

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!