Many ways of doing this, one of the neat ways of achieving the desired output is using Power Query
the following outlines both using Excel Formulas
as well as using Power Query
:
• Formula used in cell A7
=LET(
_Data, A2:C5,
_Week, TAKE(_Data,,1),
_Uniq, UNIQUE(_Week),
_Matrix, INDEX(_Data,,2),
_UniqT, TOROW(UNIQUE(_Matrix)),
_Transform, MAKEARRAY(ROWS(_Uniq), COLUMNS(_UniqT), LAMBDA(r,c,
FILTER(TAKE(_Data,,-1), (INDEX(_Uniq,r)=_Week)*(INDEX(_UniqT,c)=_Matrix),0))),
VSTACK(HSTACK(A1,_UniqT), HSTACK(_Uniq, _Transform)))
However, using POWER QUERY
will be the easiest and neat approach.
To perform the above task, follow the steps:
Table1
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Pivoted Column" = Table.Pivot(Source, List.Distinct(Source[#"Matrix Name"]), "Matrix Name", "Value")
in
#"Pivoted Column"
For future reference, if one has access to PIVOTBY()
could take advantage of the same as well:
=PIVOTBY(A2:A5,B2:B5,C2:C5,SINGLE,,0,,0)