I have paired points which I would like to combine into a string representing the best distance economy. To do this, I must start the string with the paired point representing the largest distance economy and then add the other points to the string in order of highest distance economy. It is possible to add points to either the left or the right of the string depending.
By hand, with the values below, I would start with the pair with the highest economy 34,12 and then add the second highest economy possible to the string which contains a point situated at either end of the string. Since 34 is at one end of the string I can add the point (34, 42). The string then becomes 42,34,12. Following this, the best economy is (34,11) but those points are not contained at either end of the string so the next best distance economy would be (12,04). The string then becomes 42,34,12,04. Etc..

Dist Economy Paired points
458.34 34,12
388.42 42,34
327.09 34,11
278.32 12,04
278.32 42,04
261.99 12,11
… …


Would it be possible to write a formula that would generate such a string from the two columns above?