Percentrank if function

danlan

New Member
Joined
Nov 14, 2014
Messages
3
Good Morning,

I'm trying to get a percentrank function recognize multiple variables in one column. Is there an array formula that can bring this formula all the way to the bottom as I'm working with a much larger data set.

In the percentrank column, I'm looking to place some type of formula that will calculate the percentile group of each store for that particular color. For example store 3 is in the 70th percentile group for red sales, but it is in the 30th percentile group for blue sales.

StoreColorSalesPercentrank
1Red50=+PERCENTRANK($C$2:$C$6,C2,1)
2Red55.5
3Red60.7
4Red751
5Red150
1Blue81
2Blue68
3Blue48
4Blue76
5Blue21

<tbody>
</tbody>
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Try...

D2, confirmed with CONTROL+SHIFT+ENTER, and copied down:

=PERCENTRANK(IF($B$2:$B$11=B2,$C$2:$C$11),C2,1)

Hope this helps!
 
Upvote 0
Thanks Domenic. That worked well. Do you have any ideas as to how to expand that to an 80,000 line file? When I used that, it completely locked up my computer.
 
Upvote 0
It has to do 6.4 billion comparisons, so I'd expect it to take a while.

How many stores are there among those 80000 rows? If you sorted by store and used some dynmaic ranges, it might get a lot faster.
 
Upvote 0
A couple of possibilities to avoid using PERCENTRANK as an array formula...

1) Copy each colour group to a separate sheet, and then use the regular PERCENTRANK function.

2) Sort the data by colour, in ascending order, and create a defined name to be used by PERCENTRANK. In effect, the defined name will refer to the range corresponding to the specified colour.

Post back if you prefer the second one and need help with it.

***Edit*** I see shg has already suggested the second one. I guess I'm too slow. :)
 
Upvote 0
Thanks. I appreciate all the help. The data that I shared was a small example of what I was looking for because I can't share the actual data that I'm working with. The actual data has 25 different 'colors' and about 4,000 different stores. I didn't want to make 25 different sheets as this would be a much larger file. I think that I've done the second one in the past, and this is what I was trying to avoid if possible.

I ended up using the recommended formula, but to rather than writing the formula and dragging it to the bottom. I placed the formula into a macro that was programmed to go all the way to the bottom. This took the calculation from hours to about 10 minutes. I have no idea why that worked, but I suspected it would.

Thanks again for the help.
 
Upvote 0

Forum statistics

Threads
1,215,341
Messages
6,124,391
Members
449,155
Latest member
ravioli44

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