“Combined Sort”

For long (at least starting 1985) I have a habit of writing down my options in a list and evaluating them against various parameters. This forms a simple table structure. After I could use Excel, I use rows for options and columns for parameters.

Before considering an option, I sort out this table in various sorting orders to run various possible scenarios. I decided my course, my career and my wife this way – and no regrets so far šŸ™‚ [I hope she reads this post.] Frankly, before I could get Excel, it was very laborious.

Anyway, coming back to the technical part, often I felt but today I clearly realized that often sorting by a key isn’t all that important. Sometime, we just want to know “which option would satisfy maximum number of parameters?”

As you can see, if we sort by a key a and then key b and then key c, values “yes, yes, no” and option “no, yes, yes” will appear far apart. In our need, we want them to appear close by.

Does anyone know any way to achieve this in Excel or SQL?



One comment on ““Combined Sort”

  1. Yash says:

    Let’s say each column represents cost metric for the corresponding parameter. One way for the combined sort is to first define a combined cost metric that is some weighted average of individual cost metrics (columns), and then perform the regular sort on that. Though there are many ways to do the weighted combining, one reasonable approach is to set the weights proportional to the priority given to the different parameters.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s