View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
flygis
 
Posts: n/a
Default 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