ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   UDF to sort array with multiple columns (https://www.excelbanter.com/excel-worksheet-functions/91879-udf-sort-array-multiple-columns.html)

flygis

UDF to sort array with multiple columns
 
Hi all,

I have just discovered the UDF ability in excel. Until now I have done
all my calculations with existing functions, which sometimes is hard
and
give very large help sheets with formulas.

Now I have a problem with a soccer table that I want to sort (World
Champs.) I have managed to do it with exisint functions, but it would
be
fun to do it with a UDF.
Searching the web, I have not been so much more clever, that I succeed
in my task.

This is an example of a table I want to sort (cells A2:E5 excluding the
header):

Team GoalFor GoalAgainst GoalDiff Points
Tr.a.To 3 4 -1 4
Paraguay 1 5 -4 0
England 4 5 -1 4
Sweden 7 1 6 9

This table should then be sorted to a new table (cells F2:J5 excluding
the header) by sorting the Points column followed by the GoalDiff and
GoalFor columns:

Team GoalFor GoalAgainst GoalDiff Points
Sweden 7 1 6 9
England 4 5 -1 4
Tr.a.To 3 4 -1 4
Paraguay 1 5 -4 0


Is this doable in an UDF?
Have anyone got a link to a solution?


If two or more teams has the same values in these columns they have to
be compared only counting the matches between them. But that is later
problem...

Regards,
Johan



All times are GMT +1. The time now is 09:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com