View Single Post
  #4   Report Post  
Max
 
Posts: n/a
Default

One way, if you don't mind a bit of "distributed processing" <g,
try this non-array set-up ..

Assume the source data below is in Sheet1,
cols A and B, data from row2 down

Acct Amount
A 10
B 20
C 12
D 45
E 34
F 5
G 45
A 5
C 10
D 8

etc

We'll use 4 empty cols to the right (D to G)

Put:

In D2: =IF(A2="","",IF(COUNTIF($A$2:A2,A2)1,"",ROW()))

In E2:
=IF(ISERROR(SMALL(D:D,ROWS($A$1:A1))),"",INDEX(A:A ,MATCH(SMALL(D:D,ROWS($A$1
:A1)),D:D,0)))

In F2: =IF(E2="","",SUMIF(A:A,E2,B:B))
In G2: =IF(F2="","",F2-ROW()/10^10)

Select D2:G2 and copy down to say G1000
to cover the max expected data range in cols A and B

(Col E will read col D to drive out a list of unique accts, col F sums the
amounts up by the unique accts in col E, and col G will act as an arbitrary
tie-breaker col in case there are tied amounts in col F)

In Sheet2
------------
With the same headers in A1:B1 : Acct Amount

Put in A2:

=IF(ISERROR(LARGE(Sheet1!$G:$G,ROWS($A$1:A1))),"", INDEX(Sheet1!E:E,MATCH(LAR
GE(Sheet1!$G:$G,ROWS($A$1:A1)),Sheet1!$G:$G,0)))

Copy across to B2, fill down to B1000
(cover the same range as in Sheet1)

Cols A and B will return a *full* descending sort of all the accounts by
amount, with accounts having tied amounts (if any) appearing in the same
relative order that they are in Sheet1

For the sample data in Sheet1, you'll get:

Acct Amount
D 53
G 45
E 34
C 22
B 20
A 15
F 5
( rest are blanks: "" )

--
Rgds
Max
xl 97
---
GMT+8, 1° 22' N 103° 45' E
xdemechanik <atyahoo<dotcom
----
"boris" wrote in message
...
in theory, something along those lines. Problem is that
this assumes you have unique values to rank, whereas I am
looking for it to sum, within the array itself the amounts
of all the listed accounts BY account, then evaluate THAT
virtual list for the rank. Any more ideas on how to do
that?