Using =SUMPRODUCT to calculate rank

RobynLouise

New Member
Joined
Jan 6, 2017
Messages
18
Hi

I have a data set that I need to calculate quintiles on. Essentially, my data set shows:

- the number of transactions taken place in a range of shops, broken down into hourly periods

I want to rank these transactions and calculate a quintile based not just on the time of transaction but also the county in which it takes place. The data looks as follows


Store code (F)County (G)9 - 10am (H)10am - 11am (I)11am - 12pm (J)
xxxxDevon398
xxxxCornwall7811


I want to be able to show which stores are in the bottom quintile for transactions at a certain time, in their county. I had been using the following formula:

=SUMPRODUCT(($G$3:$G$9196=G3)*(H3>=$H$3:$H$9196))/COUNTIF($G$3:$G$9196,G3) (G relates to county, H relates to transactions per hour)

However I am finding that the result (which is a percentile) is wrong because it is taking blank cells into account (these need to be excluded as the store was closed)

So can anyone help me in excluding blank cells in this formula?

Thank you
 

Some videos you may like

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.

AlanY

Well-known Member
Joined
Oct 30, 2014
Messages
4,243
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
try this



=SUMPRODUCT(($H$3:$H$9196>=0)*($G$3:$G$9196=G3)*(H3>=$H$3:$H$9196))/COUNTIF($G$3:$G$9196,G3)
 

Watch MrExcel Video

Forum statistics

Threads
1,127,348
Messages
5,624,145
Members
416,014
Latest member
MickP69

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
Top