Home > other >  Can you split a column in query
Can you split a column in query

Time:10-05

I have a functioning query, now I'm just looking to split the results of one column into two.

Query:

=QUERY(Sales!A1:I,"SELECT B, A, F, H, G, I WHERE D = 'Projects' and B >= date '"&TEXT(TODAY(),"yyyy-mm-dd")&"'Label B 'Date',A 'Resource',F 'Timeline',G 'Type',H 'LOC',I 'EST'",1)

I attempted to use

=ARRAYFORMULA(QUERY({IFERROR(SPLIT:

=ARRAYFORMULA(QUERY({IFERROR(SPLIT(Sales!A1:I, ", ")), Sales!B:I},"SELECT Col2, Col1, Col6, Col8, Col7, Col9 WHERE Col4 = 'Projects' and Col2 >= date '"&TEXT(TODAY(),"yyyy-mm-dd")&"'Label Col2 'Date',Col1 'Resource',Col6 'Timeline',Col7 'Type',Col8 'LOC',Col9 'EST'",1))

but since I have no idea what it's doing it only returned the headers, and my attempts to tweak it would just break it.

What I want to do is have Col1 or A split into 2 preferably using an underscore as the delimiter.

CodePudding user response:

try:

=ARRAYFORMULA(QUERY(
 {IFERROR(ARRAY_CONSTRAIN(SPLIT(Sales!A:A, ", "), 9^9, 2)), Sales!B:I},
 "select Col3,Col1,Col2,Col7,Col9,Col8,Col10 
  where Col5 = 'Projects' 
    and Col3 >= date '"&TEXT(TODAY(),"yyyy-mm-dd")&"'
  label Col3'Date',Col1'Resource',Col7'Timeline',Col8'Type',Col9'LOC',Col10'EST'", 1))
  • Related