# Using =SUMPRODUCT to calculate rank

#### RobynLouise

##### New Member
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) xxxx Devon 3 9 8 xxxx Cornwall 7 8 11

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

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
try this

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

#### RobynLouise

##### New Member
Thank but it's still not working!

Replies
1
Views
194
Replies
4
Views
124
Replies
1
Views
49
Replies
3
Views
197
Replies
1
Views
309

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.

### Which adblocker are you using?

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

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