Unfortunately, it does answer my question since I probably didn't explain myself good enough.
This is a hard coded solution while what I need is a dynamic one.
The set of data which I tried to demonstrate at the attached .xlsx file is only one out of hundreds of sets.
What I mean is that the data contains hundreds of record sets.
Since I can’t see any other solution I’ll create that table at the script while what I need is something that being calculated on the fly but due to the relatively low number of record sets it will be the fastest solution.