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 can I split this dataset by "|" but keep it in one column in Sheets?

I’m trying to use SPLIT() here, but it only gets the first row:
Notice that the ranges are obtained dynamically, so that moving columns around won’t lose the colum reference:

=ARRAYFORMULA(
INDIRECT("Sheet1!"&REGEXEXTRACT(ADDRESS(5,MATCH("PO #",Sheet1!$5:$5,0)),"[A-Z]+")&"5:"&REGEXEXTRACT(ADDRESS(5,MATCH("PO #",Sheet1!$5:$5,0)),"[A-Z]+"))&"|"&
INDIRECT("Sheet2!"&REGEXEXTRACT(ADDRESS(5,MATCH("PO #",Sheet2!$5:$5,0)),"[A-Z]+")&"5:"&REGEXEXTRACT(ADDRESS(5,MATCH("PO #",Sheet2!$5:$5,0)),"[A-Z]+")))

This generates, which is not the end result:

enter image description here

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

The idea is to split it by the | and stack them up and avoid blanks.

Here’s a sample of the data: https://docs.google.com/spreadsheets/d/1gh5w0czg2JuoA3i5wPu8_eOpC4Q4TXIRhmUrg53nKMU/edit?usp=sharing

Thank you!

>Solution :

use:

=ARRAYFORMULA(QUERY({
INDIRECT("Orders!"&REGEXEXTRACT(ADDRESS(6,MATCH("PO #",Orders!$5:$5,0)),"[A-Z]+")&"6:"&REGEXEXTRACT(ADDRESS(6,MATCH("PO #",Orders!$5:$5,0)),"[A-Z]+"));
INDIRECT("Scenarios!"&REGEXEXTRACT(ADDRESS(6,MATCH("PO #",Scenarios!$5:$5,0)),"[A-Z]+")&"6:"&REGEXEXTRACT(ADDRESS(6,MATCH("PO #",Scenarios!$5:$5,0)),"[A-Z]+"))}, "where Col1 is not null", ))

enter image description here


update:

=INDEX(QUERY({
 INDIRECT(   "Orders!"&ADDRESS(6, MATCH("PO #",    Orders!5:5, ))&":"&SUBSTITUTE(ADDRESS(2, MATCH("PO #",    Orders!5:5, ), 4), 2, ));
 INDIRECT("Scenarios!"&ADDRESS(6, MATCH("PO #", Scenarios!5:5, ))&":"&SUBSTITUTE(ADDRESS(2, MATCH("PO #", Scenarios!5:5, ), 4), 2, ))}, 
 "where Col1 is not null", ))

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