Search code examples
excelexcel-formula

how do I merge columns with the same header name by adding the data as a new row for that column?


Given a table like this:

Before

before

How would I merge that so there are only 3 columns: a, b and c with extra data added as new rows? there could be more than a,b,c as column names.

I am trying to create the solution in Excel

I am trying to get it like this.

result


Solution

  • Alternate solution:

    =LET(u,UNIQUE(A1:H1,1),VSTACK(u,DROP(REDUCE(0,TOROW(u),LAMBDA(a,b,IFNA(HSTACK(a,TOCOL(IFS(A1:H1=b,A2:H2),2)),""))),,1)))