Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to Change Rows of Arrays into Opposite

I have a Sheet with Column A being City and Column B being District, like so:

City Districts
Accord 103
Albany 109,110,108
Altamont 109

I would like to transform this into the "opposite":

District Cities
103 Accord
108 Albany
109 Albany, Altamont
110 Albany

I’m pretty sure it’s simple. Thanks !

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

use:

=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))

enter image description here

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading