
The secret is to build sub-arrays of the data in Query1 that you can then perform lookups on. The FILTER function lets you select all the rows for an individual. The CHOOSECOLS function lets you concentrate on the Description and the Result.
In all the following formulas, replace xxx with row number of the last line of data in Query1.
Start by building the column headers for your new table:
- In A1 enter =Query1!C1:E1
- In D1 enter =TRANSPOSE(SORT(UNIQUE(Query1!H2:Hxxx)))
Generate a row for each individual:
- In A2 enter =UNIQUE(Query1!C2:Cxxx)
Extract the data for the first individual:
- In B2 enter =VLOOKUP($A2,FILTER(Query1!$C$2:$L$xxx,Query1!$C$2:$C$xxx=$A2),2)
- Copy this cell into C2 and change the column reference from 2 to 3.
- In D2 enter =VLOOKUP(D$1,CHOOSECOLS(FILTER(Query1!$C$2:$L$xxx,Query1!$C$2:$C$xxx=$A2),6,7),2,0)
- Copy this cell into E2, F2, ... to the last column with a header in row 1
- Copy all of row 2 starting in column B down to the last row with an individual in column A