#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 50
Default Conditional Rank

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),Call s!B100),Calls!$B$1:$B$1000))

Thanks,

IP
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
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))
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 50
Default Conditional Rank

Thanks, that is a clean way of getting there. How would I incorporate a
"correction factor" for tied ranks?

"Harlan Grove" wrote:

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))

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,231
Default Conditional Rank

iperlovsky wrote...
Thanks, that is a clean way of getting there. How would I incorporate a
"correction factor" for tied ranks?

....

If you don't need to worry about being sued for arbitrary ordering of
ties, use their original entry order. If all cells in Calls!B1:B1000
contain numbers, try

=SUMPRODUCT((Calls!$A$1:Calls!$A$1000=Calls!A100)
*(Calls!$B$1:$B$1000-ROW(Calls!$B$1:$B$1000)/1E9=Calls!B100-ROW(Calls!
B100)/1E9))

Adjust the 1E9 (Excel converts this to 1000000000) figure as
necessary. It should be large enough so that the row correction term
is smaller in absolute value than MIN(Calls!$B$1:$B$1000) but not so
large that it would be discarded due to Excel's 15 decimal digit
precision. For example, if 1000000000 were one of the values in Calls!
B1:B1000 and you try to add 1/1000000000 = 0.000000001 to it, the
value would remain 1000000000 since 1000000000.000000001 would require
19 decimal digits.

If there could be nonnumeric values in Calls!B1:B1000, you'll need to
use an array formula like

=SUM((Calls!$A$1:Calls!$A$1000=Calls!A100)*IF(ISNU MBER(Calls!$B$1:$B
$1000),
Calls!$B$1:$B$1000-ROW(Calls!$B$1:$B$1000)/1E9=Calls!B100-ROW(Calls!
B100)/1E9))
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 50
Default Conditional Rank

That works as expected. I had to use the array formula because the data set
contained non-numeric blank cells. Thanks, it really solved my rank issue.

"Harlan Grove" wrote:

iperlovsky wrote...
Thanks, that is a clean way of getting there. How would I incorporate a
"correction factor" for tied ranks?

....

If you don't need to worry about being sued for arbitrary ordering of
ties, use their original entry order. If all cells in Calls!B1:B1000
contain numbers, try

=SUMPRODUCT((Calls!$A$1:Calls!$A$1000=Calls!A100)
*(Calls!$B$1:$B$1000-ROW(Calls!$B$1:$B$1000)/1E9=Calls!B100-ROW(Calls!
B100)/1E9))

Adjust the 1E9 (Excel converts this to 1000000000) figure as
necessary. It should be large enough so that the row correction term
is smaller in absolute value than MIN(Calls!$B$1:$B$1000) but not so
large that it would be discarded due to Excel's 15 decimal digit
precision. For example, if 1000000000 were one of the values in Calls!
B1:B1000 and you try to add 1/1000000000 = 0.000000001 to it, the
value would remain 1000000000 since 1000000000.000000001 would require
19 decimal digits.

If there could be nonnumeric values in Calls!B1:B1000, you'll need to
use an array formula like

=SUM((Calls!$A$1:Calls!$A$1000=Calls!A100)*IF(ISNU MBER(Calls!$B$1:$B
$1000),
Calls!$B$1:$B$1000-ROW(Calls!$B$1:$B$1000)/1E9=Calls!B100-ROW(Calls!
B100)/1E9))

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
rank the numbers / range of data using 'RANK' and 'ABS' KP Excel Worksheet Functions 1 March 8th 08 05:50 PM
Conditional Rank (or rather, Conditional Range) [email protected] Excel Worksheet Functions 6 April 16th 07 06:15 PM
Conditional formatting with Rank Sarah Excel Discussion (Misc queries) 3 March 31st 07 12:52 AM
Conditional Format Rank query Rich Excel Discussion (Misc queries) 3 June 12th 06 07:43 PM
Rank items, select one start date, have remaining dates follow based on rank rob normerica Excel Discussion (Misc queries) 1 August 15th 05 09:36 PM


All times are GMT +1. The time now is 01:53 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"