Help to fully understand this formula

easybpw

Active Member
Joined
Sep 30, 2003
Messages
437
Office Version
  1. 365
  2. 2013
Platform
  1. Windows
Everyone, thanks for all the help. I have another question. I have been trying to understand this formula I have been given but I can not understand all the parts.The formula does work wonderfuly. I use it to rank certain cells. Here it is:

=RANK(AC6,$AC$6:$AC$71)+COUNTIF($AC$6:AC6,AC6)-1

I understand the rank portion but....would someone kindly tell me in simple terms what the COUNTIF part does? That is where I get lost. Again I know the formula works as I want it but I don't understand it and a friend of mine is asking me what this part of the formula is for.

Thanks again.

Bill
 
easybpw said:
...What I was wondering is....how can I get the ranking to include the top 5? I mean that is what I asked for but because of the tie (green and yellow tied at 20) it really is only giving me the top 4. I know if I change the 5 to 6 in column E10 that would do it but lets say there isn't a tie in this instance then I would get the top 6 and I only want the top 5. I think the countif function of the formula is determining the ties, right?...

Bill,

Although I already replied to this post with a proposal, that isn't good enough. I should also add that, as far as I know, you have been the first to raise such an important issue: A self-correcting or dynamically changing 'top N parameter'.

What follows corrects my initial post on the subject/issue and is faster performancewise.

Data,including ranking...
Top5 v2.xls
ABCD
1XYRank
2blue224
3orange401
4green207
5yellow225
6brown262
7purple263
8pink226
Data


The formula for ranking in D2 is:

=RANK(B2,$B$2:$B$8)+COUNTIF(B2:$B$2,B2)-1

TopN

E1 houses the parameter Top N, currently set to 4.

The formulas...

D1:

=MAX(IF(INDEX(Data!B2:B8,MATCH(E1,Data!D2:D8,0))=Data!B2:B8,Data!D2:D8))-E1

which must be confirmed with control+shift+enter instead of just with enter.

This formula takes care of dynamic adjusting that is needed when Nth top value appears to be a tie.

A2:

=IF(B2<>"",INDEX(Data!$A$2:$A$8,MATCH(ROW()-ROW($A$2)+1,Data!$D$2:$D$8,0)),"")

B2:

=IF(ROW()-ROW($B$2)+1<=$E$1+$D$1,INDEX(Data!$B$2:$B$8,MATCH(ROW()-ROW($B$2)+1,Data!$D$2:$D$8,0)),"")

Note that this refers to E1 as well as D1.

Select A2:D2 & copy down to a sufficient numbers of rows.
 
Upvote 0

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Aladin,

Once again thanks for your help and great gift of knowledge. I will study these new formulas and use them appropriately.

Thanks again!

Bill
 
Upvote 0
Sir Aladin,

Plz I need to know that when I write your formula for Top 4 instead of showing TOP 4 its shows Top 5

I have also searched the forum and founf that in many posts

instead of the required top N its always giving N+1.


Sir Aladin Ur help (explanation) will be appreciated.


Regards
 
Upvote 0
mianmazher said:
...
Plz I need to know that when I write your formula for Top 4 instead of showing TOP 4 its shows Top 5

I have also searched the forum and founf that in many posts

This thread is the one where I designed a formula system for solving the Top N class of problems. Immensely indebted to Bill for his judicious demand to also deliver the ties of the Nth value.

instead of the required top N its always giving N+1...

Not N+1, it's rather N+x, where x >= 0. This means: When there is no multiple instances of the Nth value, you just get N.
 
Upvote 0
Sir Aladin

I am not getting.

Instead of top 5 I get 6 Values

when dealing with bottom 5 It shows the five values.

Plz tell why it does not show top 5 and shows bottom 5.


Regards
 
Upvote 0
Dear Sir John,

If I am right u mean to say that if there is a tie then it will show Top 6 instead of Top 5 I

If not a tie it will show Top 5.


Regards
 
Upvote 0
Yes; that's the point, that the formula be dynamic in that the top N values show, regardless of how many scores that is.

EDIT -- if you just want the top N period, just use RANK/LARGE/SMALL with 1 thru N.
 
Upvote 0

Forum statistics

Threads
1,216,028
Messages
6,128,399
Members
449,447
Latest member
M V Arun

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