Excel Guru's!!!

Status
Not open for further replies.

psychoe!

Solid State Member
Messages
8
If I had 20 or so people in a sports pool with weekly points, what funtion would I use to sort them out in order from 1 - 20?

How would I use this function?

The only way I know of is this:

A1=50 B1=Frank
A2=45 B2=Bob

=IF(A1>A2,B1,B2)

this would print "Frank"

Only problem is this only compares 2, not 20 or more.

Thanks

E!
 
You could do something like the following in VB :

Code:
Sub sort()
    
    ' Change this line to suit your selection requirements [I.E. ("A1:F65536") or ("A:F")]
    Columns("A:B").Select
    
    ' The lines below sort the data, starting with column A in ascending, then column B in ascending order
    Selection.sort Key1:=Range("A1"), Order1:=xlAscending, Key2:=Range("B1") _
        , Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:= _
        False, Orientation:=xlTopToBottom
    
    ' Select Cell A1 once all data has been sorted correctly
    Range("A1").Select
End Sub
 
Status
Not open for further replies.
Back
Top Bottom