How do I sort a list of addresses by index number?

Something like this (tested this recently, looks like the Google Sheets link is dead; it should still work for yours). Just change the number of textboxes and the corresponding code to the number of fields you have.