Home > Software engineering >  How to vertically combine specific columns of a sheet, while producing a category column to each dat
How to vertically combine specific columns of a sheet, while producing a category column to each dat

Time:08-20

I'm pretty sure that this is possible with a formula, but I don't know which way to take: =ARRAYFORMULA(), =UNIQUE(), =QUERY() or =TRANSPOSE()?

Something like: =QUERY({A4:B9;C4:D9},"select * where Col1 is not null"), but how can I produce column Category?

This is the scenario:

enter image description here

enter image description here

One could also use the following part for the category

TRANSPOSE(SPLIT(REPT("A,",COUNTA(A4:A11)),",",1,1))

CodePudding user response:

use:

=QUERY({QUERY(A4:B, "select 'A',A,B"); 
        QUERY(C4:D, "select 'B',C,D")}, 
 "where Col2 is not null", )

enter image description here

  • Related