如何将数组的行更改为相反的行
How to Change Rows of Arrays into Opposite
我有一个 Sheet,其中 A 列是城市,B 列是地区,如下所示:
City
Districts
Accord
103
Albany
109,110,108
Altamont
109
我想把这个改成“相反”:
District
Cities
103
Accord
108
Albany
109
Albany, Altamont
110
Albany
我敢肯定这很简单。谢谢!
使用:
=ARRAYFORMULA(QUERY(SPLIT(REGEXREPLACE(TRIM(FLATTEN(
QUERY(QUERY(SPLIT(FLATTEN(SPLIT(B2:B, ",")&"¤×"&A2:A&","), "×"),
"select max(Col2) group by Col2 pivot Col1"),,9^9))),
",$", ), "¤ ", 0), "where Col2 is not null", 0))
我有一个 Sheet,其中 A 列是城市,B 列是地区,如下所示:
City | Districts |
---|---|
Accord | 103 |
Albany | 109,110,108 |
Altamont | 109 |
我想把这个改成“相反”:
District | Cities |
---|---|
103 | Accord |
108 | Albany |
109 | Albany, Altamont |
110 | Albany |
我敢肯定这很简单。谢谢!
使用:
=ARRAYFORMULA(QUERY(SPLIT(REGEXREPLACE(TRIM(FLATTEN(
QUERY(QUERY(SPLIT(FLATTEN(SPLIT(B2:B, ",")&"¤×"&A2:A&","), "×"),
"select max(Col2) group by Col2 pivot Col1"),,9^9))),
",$", ), "¤ ", 0), "where Col2 is not null", 0))