Thanks for your help! Though, I didn't really manage to get it working, plus my data is arranged in another way.

I've added a workbook with an example of my data, if you or anyone wants to take a look:

Sorting Workbook.xlsx