SORTBY function

The SORTBY function sorts the contents of a range or array based on the values in a corresponding range or array.