=ARRAYFORMULA({UNIQUE(QUERY(models,
"select F,E,R,R*(1-0.15),R*0.15,R*1.07
where J = '"&$A$1&"'
and (F = 'rec99pY85FrcpKWmh'
or F = 'reccliFdf3cbYeADx')
and F <> ''
label R 'Retail excl. VAT',R*(1-0.15)'Store Price',R*0.15'Margin',R*1.07'Retail incl. VAT'
format R '฿ ###,##0',R*(1-0.15) '฿ ###,##0',R*0.15 '฿ ###,##0',R*1.07 '฿ ###,##0'", 1)),
{"Sizes"; IFERROR(VLOOKUP(INDEX(UNIQUE(QUERY(models,
"select F,E,R,R*(1-0.15),R*0.15,R*1.07
where J = '"&$A$1&"'
and (F = 'rec99pY85FrcpKWmh'
or F = 'reccliFdf3cbYeADx')
and F <> ''
label R'',R*(1-0.15)'',R*0.15'',R*1.07''", 0)),,2), Sizes!A:G, 7, 0))},
{"Materials"; IFERROR(VLOOKUP(INDEX(UNIQUE(QUERY(models,
"select F,E,R,R*(1-0.15),R*0.15,R*1.07
where J = '"&$A$1&"'
and (F = 'rec99pY85FrcpKWmh'
or F = 'reccliFdf3cbYeADx')
and F <> ''
label R'',R*(1-0.15)'',R*0.15'',R*1.07''", 0)),,1), Materials!A:B, 2, 0))}})
=ARRAYFORMULA({{"Material"; IFERROR(VLOOKUP(INDEX(UNIQUE(QUERY(models,
"select F,E
where J = '"&$A$1&"'
and (F = 'rec99pY85FrcpKWmh'
or F = 'reccliFdf3cbYeADx')
and F <> ''", 0)),,1), Materials!A:B, 2, 0))},
{"Size"; IFERROR(VLOOKUP(INDEX(UNIQUE(QUERY(models,
"select F,E
where J = '"&$A$1&"'
and (F = 'rec99pY85FrcpKWmh'
or F = 'reccliFdf3cbYeADx')
and F <> ''", 0)),,2), Sizes!A:G, 7, 0))},
UNIQUE(QUERY(models,
"select R,R*(1-0.15),R*0.15,R*1.07
where J = '"&$A$1&"'
and (F = 'rec99pY85FrcpKWmh'
or F = 'reccliFdf3cbYeADx')
and F <> ''
label R 'Retail excl. VAT',R*(1-0.15)'Store Price',R*0.15'Margin',R*1.07'Retail incl. VAT'
format R '฿ ###,##0',R*(1-0.15) '฿ ###,##0',R*0.15 '฿ ###,##0',R*1.07 '฿ ###,##0'", 1))})