How to sort two lists? Sort distance
05-02-2016, 04:56 AM
Post: #5
 cyrille de brébisson Senior Member Posts: 1,047 Joined: Dec 2013
RE: How to sort two lists?
Hello,

in Home, you can use the SORT(List, item in list to sort by) syntax.
Sorry, but the help for SORT does not seem to have been updated...

Anyhow, SORT now takes 2 parameters, the list to sort and one or more sequence of sort indexes...

assuming that L1 is a list of lists.
so, SORT(L1, a) sorts by element a of the sub lists
SORT(L1, {a, b, c}) sorts by element a, then b, then c of the sub list (b is used if elements a are equal...)
you can even do
SORT(L1, {{a, b, c}, d}) in this case {a, b, c} means sort L1 by the element (a, b, c) of L1, is recall cth element of the bth list of the ath list of L1!
ie, the {a, b, c}, follows the same rules as L1(parameters)... you can of course use this, to sort by nth element in matrices in lists and the like...

Cyrille

Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP.
 « Next Oldest | Next Newest »

 Messages In This Thread How to sort two lists? Sort distance - StephenG1CMZ - 04-29-2016, 07:06 PM RE: How to sort two lists? - parisse - 04-29-2016, 07:33 PM RE: How to sort two lists? - primer - 04-29-2016, 09:22 PM RE: How to sort two lists? - StephenG1CMZ - 04-30-2016, 10:04 AM RE: How to sort two lists? - parisse - 05-02-2016, 05:44 AM RE: How to sort two lists? - cyrille de brébisson - 05-02-2016 04:56 AM RE: How to sort two lists? - Tyann - 05-02-2016, 05:32 AM RE: How to sort two lists? - Didier Lachieze - 05-02-2016, 06:57 AM RE: How to sort two lists? - Tyann - 05-02-2016, 10:35 AM RE: How to sort two lists? - Didier Lachieze - 05-02-2016, 04:00 PM RE: How to sort two lists? - Tyann - 05-02-2016, 05:10 PM RE: How to sort two lists? - DrD - 05-02-2016, 11:11 AM RE: How to sort two lists? - StephenG1CMZ - 05-02-2016, 12:11 PM RE: How to sort two lists? - cyrille de brébisson - 05-02-2016, 03:34 PM RE: How to sort two lists? - ailoher - 12-03-2019, 10:24 AM RE: How to sort two lists? - Didier Lachieze - 12-03-2019, 05:02 PM RE: How to sort two lists? - StephenG1CMZ - 12-03-2019, 04:43 PM RE: How to sort two lists? - Albert Chan - 12-03-2019, 06:00 PM RE: How to sort two lists? - StephenG1CMZ - 12-03-2019, 07:30 PM RE: How to sort two lists? - ailoher - 12-05-2019, 06:55 PM RE: How to sort two lists? - StephenG1CMZ - 12-06-2019, 12:30 AM

User(s) browsing this thread: 1 Guest(s)