sort automatically

patxecs

New Member
Joined
Sep 11, 2011
Messages
5
I have a soccer table and I want it to automatically sort who is in first place, second, etc, when I change the values.

My table is this:

2w6dxc3.jpg



"Casa" are the home games; "Fora" are away games.
J = Games played
V = Victory
E = Draw
D = Defeat
GM = Goals scored
GS = Goals conceded
DIF = Goal difference
P = Points

The table is full of functions. If I change the goals scored in away games and the number of draws for example, it will change all the totals.

I want the points to sort automatically so the first team is the one with more points. How can I do this?
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Sorting upon data entry is not usually a good idea.
It takes the value the user entered and immediately moves it somewhere else, making it harder for the user to check for a mistyped entry.
 
Upvote 0
The sort could be triggered by a button or double clicking a cell or a variety of methods. My point is that entering data is a poor trigger for a sort routine.

As for sorting your data. How do you determine whether one team is above another?
It might be easier if there were a (total) Percentage of Games Won column.
 
Upvote 0
The teams are sorted by the number of points in column named "P"

The first team is the one with more points.

Maybe I can use a button to sort it whenever I want?
 
Upvote 0
This routine will sort the file, a button from the forms menu could be assigned to this macro.
Code:
Sub sortResults()
    With Range(Range("P3"), .Cells(Rows.Count, 1).End(xlUp))
        .Sort Key:=Range("P3"), order1:=xlDescending, Header:=xlNo
    End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,578
Messages
6,179,652
Members
452,934
Latest member
mm1t1

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top