4

Having a table with data like:

-   +   +   -
-   -   -   -
+   +   -   -

where + and - are created via '-, '+ commands,

how to sort it recursively (probably other word shall be used) meaning sort by first column, group -> sort each group by second column, group -> ... for first N columns?

3 Answers 3

2

There is a way to do it, but it's a bit cumbersome. I've prepared the folowing data in the DATA sheet:
enter image description here

In another sheet (SORT) you can apply the SORT function:
=SORT(DATA!A3:J40,DATA!A1,DATA!A2,DATA!B1,DATA!B2,DATA!C1,DATA!C2,DATA!D1,DATA!D2,DATA!E1,DATA!E2,DATA!F1,DATA!F2,DATA!G1,DATA!G2,DATA!H1,DATA!H2,DATA!I1,DATA!I2,DATA!J1,DATA!J2)

This will yield the following: enter image description here

Now you will be able to change the sort by changing the second row (sheet DATA) from 0 to 1. You can even change the column numbering. The SORT function allows for up to 30 different sorting options. You need a very big pool of data, in order for it to be effective.

See example file I created: Sort With Many Columns

1

You cannot, like in other spreadsheet programs like f.e. Excel, define explicitly on what list of columns to sort on in what order.

However, you can achieve the same result manually. If you wanted f.e. to primarily sort by column A and secondarily by column B, you can just first sort everything by column B and afterwards by column A.

This works because, when sorting on a certain column, the order of elements with the same value for that column will remain the same.

0

Question is not clear to me but clicking on "Add another sort column" would perhaps be enough:

WA43529 example

1
  • Why don't you show the audience how that's being done? Add a screenshot or example sheet would help.
    – Jacob Jan
    Commented Jul 14, 2014 at 19:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.