Using =SUMPRODUCT to calculate rank

RobynLouise

New Member
Joined
Jan 6, 2017
Messages
20
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
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
try this



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

Forum statistics

Threads
1,214,788
Messages
6,121,577
Members
449,039
Latest member
Arbind kumar

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