SORT function in Numbers app

It would be nice if a SORT function exists in Numbers. For example in Mathematica the function's format is SORT(list) and it could look like this - see snapshot below.

Any workaround (excluding Applescript)?

Posted on Aug 7, 2022 2:40 PM

Reply
Question marked as Top-ranking reply

Posted on Aug 7, 2022 5:51 PM

Spreadsheets are much better at sorting lists arranged in columns than in rows.



If you put your list in a column like this:



Then all you have to do is this (no formulas):







SG

6 replies

Aug 8, 2022 11:07 PM in response to KK097

I believe with additional step you should be able to sort anything but, for some reason that eludes me at this late hour, it is not working. I therefore have a question for the forum based on this experiment. Either the method does not really work or I messed up the formula(s) or there is bug in the COUNTIF function that makes this method fail with mixed data types (numbers and text, even if the numbers are formatted as text). Or maybe I am misusing "<=".  I hope someone here can figure out what is going wrong in row 7. 


A:D are the original arrangement. I:L are sorted ascending. All looks good until row 7


Formulas:

E2 =COUNTIF($A2:$D2,"<="&A2)

Fill right to H2

I2 =INDEX($A2:$D2,MATCH(SMALL($E2:$H2,I$1),$E2:$H2))

Fill right to L2

Fill down with those formulas


It is messing up in row 7 due to incorrect results in E7:H7. If I manually test each "<=" I get a different result than what COUNTIF is getting. Here is what I get for A7:


I get the answer is 2 but COUNTIF is giving the answer as 1. If I format A:D as text it does not change the answers (but it does get rid of the blue triangles).


I exported to Excel and it gives the same results for the COUNTIFS. In addition, the INDEX(MATCH)) formula in Excel fails in numerous cells for no reason I can explain. For example, in cell I2 the MATCH part cannot find a match unless I include the parameter for "exact match" or change it to XMATCH. Really strange.


I am baffled at the moment.


This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

SORT function in Numbers app

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.