How to sort a Numbers’ table using data from another table

numbers

So, I've got this data set coming from questionnaires. I created one table per question, questionnaires in rows, answers in columns, and everything is fine and dandy, but now I have this situation where the questionnaires pertain to a number of different groups. So I created a table associating the ID of the questionnaires with their group, and then I sorted it and I've got a nice aggregated view of questionnaires' IDs grouped together depending on their group.

Now I'd like to sort all my other tables' rows accordingly. Is this even possible? I know I should have done this before beginning to import the data…

EDIT Sample document at http://www.morpheu5.net/public/sample.zip

Example of what I start with:
enter image description here

And (below image ) if you sort table "Condition" by column "c", you get a different sorting of the head column with the IDs.

This and the sorting I need to replicate on table "Q5.6…"

enter image description here

EDIT 2 I temporarily "solved" by copying column "c" from table "Condition" to all the other tables and used that to sort accordingly. I'm not marking this as my answer in case somebody comes up with a more efficient/correct way.

Best Answer

Thanks to your sample file, I think I was able to do what you wished.

Using an additional column to bring in the numbers corresponding to the codes (16AA, 1; 16AE, 2...) sorting by that column then hiding it the desired result was accomplished. To refresh the sort after adding data, unhide the column and sort again.

Here are the steps:

  • Create new column to the left of the "Code" column. enter image description here

  • Add a formula to extract the proper number for each code and copy down. Formula

  • Formula: =INDEX (Group::c, MATCH (B, Group::A))

(Using INDEX(MATCH) is a good way to get column data with out worrying about extra columns being added as is the case with VLOOKUP.)

  • Copy the formula down, sort the column and hide it if desired.

Result:

Final result