Perhaps this formula based solution will be helpful.
On sheet 1 columns C:H are populated using:
Formula:
=TRIM(MID(SUBSTITUTE($B2,CHAR(10),REPT(" ",LEN($B2))),(COLUMN(A:A)-1)*LEN($B2)+1,LEN($B2)))
I1 displays the number of rows that will be needed using: =SUM(I2:I4)
I2 and down are populated using: =SUMPRODUCT(--(C2:H2<>""))
J1 has the value of zero typed in.
J2 and down are populated using: =SUM(I$2:I2)
On sheet 2 column A, which may be moved and/or hidden for aesthetic purposes, is populated using: =IFERROR(IF(A1+1<=Sheet1!I$1,A1+1,""),"")
Column B is populated using:
Formula:
=IF(A2="","",INDEX(Sheet1!A$2:A$5,IF(ISNUMBER(MATCH(A2,Sheet1!J$2:J$5,0)),MATCH(A2,Sheet1!J$2:J$5,0),MATCH(A2,Sheet1!J$1:J$5,1))))
Column C is populated using:
Formula:
=IFERROR(INDEX(Sheet1!C$2:H$3,MATCH(B2,Sheet1!A$2:A$5,0),COUNTIFS(B$2:B2,B2)),"")
Let us know if you have any questions.
Bookmarks