My data set is :
S1 S2 S3 S4
1 4 7 20
2 6 8 21
3 9 10 30
and i convert data as per condition that sort as per maximum difference value between each column value
data after the condition should be like this
S4 S2 S3 S1
20 4 7 1
21 6 8 2
30 9 1 3
explanation: the difference between max and min value
for S4 is 30 - 20 =10
for S2 is 9-4 = 5
for S3 is 10-7 = 3
for S1 is 3-1 =2
and the columns are sorted as per the difference value of max and min.