Ranking with sumproduct & countif with extra conditions

azdraon

New Member
Joined
Aug 16, 2021
Messages
4
Office Version
  1. 2016
Platform
  1. Windows
Hey everyone. I have been stuck on this issue for a few days now. I have multiple criteria for the ranking, "State" and "Type". And I want it to be ranked based on the "Share". This is just a sample and actually have hundred of rows. I have figured it out so that it filters to the State and Type for the SUMPRODUCT(). But when I try to throw in a COUNTIF() I get crazy decimal places (see Group Rank (calc)).

Here is my formula. My desired result would be a rank with repeating values. Actually the decimals go out much further, and I can't symply "ROUND()" that I can figure out to resolve this issue.

Group Rank (calc) =SUMPRODUCT((--([@State]=[State])),(--([@[Line Of Business]]=[Line Of Business])),(--([@[Share]]<=[Share]))/COUNTIF([Share],[Share]))

StateLine of BusinessShareGroup Rank (calc)
IAHomeowners
2303​
1.3​
IAHomeowners
257​
7.1​
IAHomeowners
264​
6.1​
IAHomeowners
264​
6.1​
IAHomeowners
264​
6.1​
IAHomeowners
335​
5.2​
IAHomeowners
335​
5.2​
IAHomeowners
355​
4.6​
IAHomeowners
355​
4.6​
IAHomeowners
500​
4.3​
IAHomeowners
899​
3.3​
IAHomeowners
899​
3.3​
IAHomeowners
899​
3.3​
IAHomeowners
899​
3.3​
IAHomeowners
1162​
2.3​
IAHomeowners
1162​
2.3​
IAHomeowners
1162​
2.3​
 
This is the part of the formula that I think is breaking down when there is more data

(--([@Share]<=[Share])/COUNTIF([Share],[Share]))

It doesn't differentiate the Share amounts by the other criteria and then gives a screwy result once more data is introduced that doesn't match the sample data provided.
 
Upvote 0

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Another option
+Fluff 1.xlsm
ABCDE
1StateLine of BusinessShareGroup RankColumn1
2IAHomeowners230311
3IAHomeowners116222
4IAHomeowners116222
5IAHomeowners116222
6IAHomeowners89953
7IAHomeowners89953
8IAHomeowners89953
9IAHomeowners35584
10IAHomeowners33595
11IAHomeowners264106
12IAHomeowners264106
13IAHomeowners257127
14IArent89911
15IArent50022
16IBHomeowners35511
17IBrent33511
18IBrent26422
Lists
Cell Formulas
RangeFormula
D2:D18D2=COUNTIFS([State],[@State],[Line of Business],[@[Line of Business]],[Share],">"&[@Share])+1
E2:E18E2=SUMPRODUCT((--([@State]=[State])),(--([@[Line of Business]]=[Line of Business])),IFERROR(--([@Share]<=[Share])/COUNTIFS([State],[@State],[Line of Business],[@[Line of Business]],[Share],[Share]),0))
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,751
Members
448,989
Latest member
mariah3

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