I would like to transform the data from table 1 to table 2 in Excel.
What Excel formula can I use?
You need a Pivot Table. To build the one you want is easy:
id
subid
measure