If you are willing to go the Power Query method then here is the Mcode. Look at the links in my signature for how to apply. Also attached file for review.
let
Source = Excel.CurrentWorkbook(){[Name="Table2"]}[Content],
#"Added Index" = Table.AddIndexColumn(Source, "Index", 0, 1),
#"Pivoted Column" = Table.Pivot(Table.TransformColumnTypes(#"Added Index", {{"Index", type text}}, "en-US"), List.Distinct(Table.TransformColumnTypes(#"Added Index", {{"Index", type text}}, "en-US")[Index]), "Index", "Test"),
#"Added Custom" = Table.AddColumn(#"Pivoted Column", "Custom", each if([TT]="Assembly") then [0] & "|" & [1] & "|" & [2] else [3] & "|" & [4] & "|" &[5] & "|" &[6]),
#"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"2", "3", "4", "5", "6", "0", "1"})
in
#"Removed Columns"
Bookmarks