Ranking percentages

mandyfsu

New Member
Joined
Jan 30, 2007
Messages
3
I am trying to rank a set of percentages that are positive and negative. I would like to treat the negative values as positive and rank accordingly. I can not figure out which formula to use. Please help.
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
I am trying to rank a set of percentages that are positive and negative. I would like to treat the negative values as positive and rank accordingly. I can not figure out which formula to use. Please help.

Create a 2nd range of data with ABS...

=ABS(A2)

and invoke in C2...

=RANK(B2,$B$2:$B$25)

Or, without an additional range, invoke:

=SUMPRODUCT((ABS($A$2:$A$15)>ABS(A2))+0)+1
 
Upvote 0
The formula worked, although it put them in order from descending rather than ascending. Can you explain how the formula actually works in case I need to modify it? Thanks for your help.
 
Upvote 0
The formula worked, although it put them in order from descending rather than ascending. Can you explain how the formula actually works in case I need to modify it? Thanks for your help.

For an ascending result, change > to <...

=SUMPRODUCT((ABS($A$2:$A$15)>ABS(A2))+0)+1

is qua form the same as

=RANK(A2,$A$2:$A$15)

which is, written in terms of CountIf...

=COUNTIF($A$2:$A$15,">"&A2)+1

The latter I guess is obvious. This can be re-written in terms of SumProduct...

=SUMPRODUCT(($A$2:$A$15)>A2)+0)+1

Since SumProduct admits arrays and

ABS($A$2:$A$15)

is an array, we can introduce ABS in the latter formula, an action that gives us:

=SUMPRODUCT((ABS($A$2:$A$15)>ABS(A2))+0)+1

For SumProduct, see:

http://www.mrexcel.com/board2/viewtopic.php?t=59063

http://www.mrexcel.com/board2/viewtopic.php?t=133602
 
Upvote 0
Great. Thanks. Can you tell me what the 0 and 1 do at the end of the formula?

+0 coerces the evaluations of the conditionals like (ABS($A$2:$A$15)>ABS(A2)) to 1's and 0's (TRUE--> 1; FALSE --> 0).

+1 takes care of counting in the compared value. Otherwise, we would get a 0 rank for one of the values in the range of question. Put otherwise: It helps us to start ranking with 1 instead of 0, that is, R = 1,2,..,N instead of R = 0,1,2,...,N-1.
 
Upvote 0

Forum statistics

Threads
1,214,516
Messages
6,119,976
Members
448,934
Latest member
audette89

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