Hello, I am designing an excel file to run an analytical formula and the values are all hyper-linked into another program to be dealt with further. My issue is that I am creating a general spreadsheet such that the raw data of all of our experiments can simply be pasted in and graphs, values, and ANOVA tests are pumped out in the second program. The experiments are all formatted very similarly but I am having aproblem with sorting. For clarity of work I have each step of the formula/process in a different Excel sheet within the same file. Here's my setup..

The raw data is pasted in.
A lookup table assigns a group number to each subject based on treatment received- The treatments are all consistent as of now but I may be back asking for some help in this area later.
The Treatment groups are sorted. [Offending step]
The Formula is ran and the results are placed in a manner that they can be exported.
The subject numbers are not in the same order with every file so I need either a reference command or a Macro to automatically sort them by group number. A macro would be greatly appreciated and maybe some general instructions on running it. I am absolutely clueless with them and realize that there are other threads on the topic but I'm having trouble connecting some of them to my issue. I am much more familiar with referencing than I am with Macros.
Thank you for your help!