View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Harlan Grove[_2_] Harlan Grove[_2_] is offline
external usenet poster
 
Posts: 1,231
Default Conditional Rank

iperlovsky wrote...
I am trying to use the following function to rank part of an array based on
one condition, but the function returns the rank for the entire array. *Any
suggestions?

RANK(IF((Calls!$A$1:Calls!$A$1000=Calls!A100),Cal ls!B100),Calls!$B$1:$B$1000))


I'm guessing you want the rank for Calls!B100 within those cells in
Calls!B1:B1000 corresponding to cells in Calls!A1:A1000 equal to Calls!
A100. If Excel would allow it, that'd be

=RANK(Calls!B100,IF(Calls!$A$1:Calls!$A$1000=Calls !A100,Calls!$B$1:$B
$1000))

However, Excel only supports range references as 2nd argument to RANK,
not arrays. You'd need to use something like

=SUMPRODUCT((Calls!$A$1:Calls!$A$1000=Calls!A100)* (Calls!$B$1:$B
$1000=Calls!B100))

if all cells in Calls!B1:B1000 contain numbers. If some could contain
text, e.g., contain formulas that could evaluate to "", try

=SUMPRODUCT((Calls!$A$1:Calls!$A$1000=Calls!A100)* ISNUMBER(Calls!$B
$1:$B$1000)*(Calls!$B$1:$B$1000=Calls!B100))