kurrajong60

Q: Can data be sorted by multiple columns in numbers version 3

Since upgrading Numbers to version 3 (now 3.0.1) I have been unable to sort data in spreadsheets using multiple columns.  Anyone found a solution?

 

Regards

 

kurrajong60

Numbers, OS X Mavericks (10.9)

Posted on Nov 23, 2013 2:47 PM

Close

Q: Can data be sorted by multiple columns in numbers version 3

  • All replies
  • Helpful answers

  • by Rudegar,

    Rudegar Rudegar Nov 23, 2013 3:20 PM in response to kurrajong60
    Level 7 (28,904 points)
    Apple TV
    Nov 23, 2013 3:20 PM in response to kurrajong60

    if I were you then I would try asking here

    https://discussions.apple.com/community/iwork/numbers

  • by SGIII,

    SGIII SGIII Nov 23, 2013 4:52 PM in response to kurrajong60
    Level 6 (10,782 points)
    Mac OS X
    Nov 23, 2013 4:52 PM in response to kurrajong60

    Hi kurrajong60,

     

    Multiple column sort is not yet built into the interface of Numbers 3 but Apple has announced in this support document that it will be reintroduced in upcoming versoions.

     

    Meanwhile, there is an ugly but easy workaround,

     

    Say you have columns A,B, and C and you want to sort first by A then within A by C then within that by B.

     

    Add a column D in which you put the formula =A&C&B.  Then sort by column D.

     

    If one of your columns you need to sort has numbers let me know and I can give you a workaround on how to make those sort properly using this method.

     

    SG

  • by Hiroto,Helpful

    Hiroto Hiroto Nov 23, 2013 5:27 PM in response to kurrajong60
    Level 5 (7,348 points)
    Nov 23, 2013 5:27 PM in response to kurrajong60

    Hello

     

    Given the primary sort key (column) is A, secondary sort key is B and tertiary sort key is C, you can sort the table firstly by C, then by B and finally by A, each in its own ascending or descending order. It will yield the same result as the sort by three keys (A, B, C) because proper spreadsheet programme is to perform stable sort (that is to preserve the original order of the elements which have the same key value).

     

    Regards,

    H

  • by SGIII,Solvedanswer

    SGIII SGIII Nov 23, 2013 5:50 PM in response to kurrajong60
    Level 6 (10,782 points)
    Mac OS X
    Nov 23, 2013 5:50 PM in response to kurrajong60

    Here's a simple example. Say you want this sorted first by Region then by Name then by Amount.

    Screen Shot 2013-11-23 at 8.39.33 PM.png

     

    So if you set up a sort index column with a simple formula and all you have to do is this (two clicks):

    Screen Shot 2013-11-23 at 8.40.16 PM.png

     

     

    Giving you this:

    Screen Shot 2013-11-23 at 8.40.42 PM.png

     

    Of course you could do it as I think Hiroto is suggesting and manually sort first by column B, then sort by C, then sort by A.

     

    But that's a lot of trouble and it's easy to confuse the order so you end up having to start over again.

     

    SG

  • by kurrajong60,

    kurrajong60 kurrajong60 Nov 23, 2013 6:01 PM in response to Hiroto
    Level 1 (0 points)
    Nov 23, 2013 6:01 PM in response to Hiroto

    Hiroto

     

    Thankyou for your advice, very helpful

     

    Regards

     

    Kurrajong60

  • by kurrajong60,

    kurrajong60 kurrajong60 Nov 23, 2013 6:02 PM in response to SGIII
    Level 1 (0 points)
    Nov 23, 2013 6:02 PM in response to SGIII

    SG

     

    Thankyou for the effort you put into this, very much appreciated!

     

    Regards

     

    Kurrajong60

  • by SGIII,

    SGIII SGIII Nov 23, 2013 6:05 PM in response to kurrajong60
    Level 6 (10,782 points)
    Mac OS X
    Nov 23, 2013 6:05 PM in response to kurrajong60

    Hi kurrajong60,

     

    No problem. Post here if you end up having to sort columns with numbers of varying lengths that mess up the sort a little. There's an easy workaround for that if you run into that problem. 

     

    And if we're lucky, Apple will restore multicolumn sort before too long.

     

    SG

  • by Hiroto,Helpful

    Hiroto Hiroto Nov 24, 2013 7:24 AM in response to SGIII
    Level 5 (7,348 points)
    Nov 24, 2013 7:24 AM in response to SGIII

    Note that there're serious limitations of sort by concatenated columns:

     

    1) It won't let you sort by each key in different order. E.g., A in ascending, B in descending and C in ascending can not be achieved by concatenated key.

     

    2) Concatenated key can give wrong sorting result depending upon the characteristics of data. E.g., in the first table in the screenshot below, sort by key = A&B or key = A&" "&B will yield wrong result while sort by key = A&CHAR(8232)&B yield correct result, where CHAR(8232) is U+2028 LINE SEPARATOR. The point is to use a field separator which a) is not present in data AND b) comes before any characters in data when sorted in ascending order. The second table demonstrates the failure case of key = A&CHAR(8232)&B, where requirement b) is not met because Numbers internally represent U+2028 as <sf:lnbr></sf:lnbr> and manually entered line break in cell as <sf:br></sf:br> and the latter comes before the former when sorted in ascending order.

     

    a.png

     

    Meanwhile the series of individual sort by each key in reverse significance order will always yield the correct result regardless of the characteristics of data set.

     

    Regards,

    H

  • by SGIII,

    SGIII SGIII Nov 24, 2013 7:48 AM in response to Hiroto
    Level 6 (10,782 points)
    Mac OS X
    Nov 24, 2013 7:48 AM in response to Hiroto

    Thanks, Hiroto, for the helpful explanations.

     

    I like the tip on using a field separator not present in the data.

     

    But the purpose of the simple workaround is just that: to serve as a simple, convenient workaround until Apple reintroduces multiple column sort.

     

    The workaround is convenient to use in many (probably most) situations of everyday spreadsheet use. For columns with numbers, padding with leading "zeros" works in most situations and it's easy to do.

     

    In situations where the workaround doesn't work, as in your examples, one can do the successive manual sorts by each column in reverse signficance order as you have described.

     

    Let's hope Apple gets multi-column sort right when they reintroduce it.

     

    Best,

     

    SG