Rank based on Multiple criteria (Like a RankIFS)

calecote

New Member
Joined
Oct 5, 2011
Messages
12
Hi,


I've read a lot of the forums on who to use rank based on multiple criteria, but I need to rank criteria based on multiple criteria.

I tried using something like this: =COUNTIF($B26:$T26,">"&N26)+1+SUMPRODUCT(--($B26:$T26=N26),--($B27:$T27>N27)) but it doesnt work for what I'm looking to do.

ChannelCategoryWeekUnitsSalesRank
GroceryApple17$18.002
GroceryApple17$21.001
GroceryApple22$6.001
GroceryOrange25$15.001
HomeApple13$9.002
HomeApple19$27.001
HomeApple23$9.001
RestaurantOrange25$15.002
RestaurantOrange27$21.001
RestaurantOrange21$3.003

<tbody>
</tbody>

I want to create one formula I can drag down that chooses the most units than the most sales based on the criteria of Channel, category and week.

Thanks,

Cale
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Try:

ABCDEF
1ChannelCategoryWeekUnitsSalesRank
2GroceryApple17$18.00 1
3GroceryApple17$21.00 1
4GroceryApple22$6.00 1
5GroceryOrange25$15.00 1
6HomeApple13$9.00 2
7HomeApple19$27.00 1
8HomeApple23$9.00 1
9RestaurantOrange25$15.00 2
10RestaurantOrange27$21.00 1
11RestaurantOrange21$3.00 3

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet1

Worksheet Formulas
CellFormula
F2=COUNTIFS(A:A,A2,B:B,B2,C:C,C2,D:D,">"&D2)+1

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>
 
Upvote 0
Hey Eric,

Thanks so much for the help. The formula looks great, but unfortunately I want the formula to first rank on units and then if there is a tie rank based on Sales.

Other than that the formula does work though!

Thanks,

Cale
 
Upvote 0
In that case, try:

=SUMPRODUCT(--($A$2:$A$11=A2),--($B$2:$B$11=B2),--($C$2:$C$11=C2),--($D$2:$D$11*100000+$E$2:$E$11>D2*100000+E2))+1

You shouldn't use whole column references here, since SUMPRODUCT isn't aware of the end of range like COUNTIFS is. Use a specific row for the max. The 100000 in the formula (twice) should be a value greater than your largest sales amount.

Good luck!
 
Upvote 0
Hi Eric,

Wen I do that it brings back an #N/A. I updated the formula to be reflective of my sheet:

=SUMPRODUCT(--($L$2:$L$15378=L3),--($M$2:$M$15378=M3),--($N$2:$N$15378=N3),--($G$2:$G$15378*100000+$K$2:$K$15378>G3*100000+K3))+1

L= Channel
M= Category
N=Week Number
G= Unit Sales
K= Gross Margin

I tried to look by evaluating the formula, but the sumproduct is too large for me to know where the error occurs.

Thanks for all the help!

Cale
 
Upvote 0
The SUMPRODUCT may look large, but it's not that bad. Each interior set of parentheses is just one condition. The long one at the end is creating a combined condition using the units and sales.

I took your formula exactly as you wrote it, and inserted it into my sheet, and it worked. My assumption is that somewhere in your range is an error of some kind. A word in a numeric column, or if you're using lookups in that range, you're getting a #N/A when something isn't found. To handle that, you could try to find and fix the data, or use the updated version below in column Q. You'll need to enter this version with Control+Shift+Enter.

GHIJKLMNOPQ
1
2UnitsSalesChannelCategoryWeekRank
37$18.00 GroceryApple1#N/A2
47$21.00 GroceryApple1#N/A1
52$6.00 GroceryApple2#N/A1
65$15.00 GroceryOrange2#N/A1
73$9.00 HomeApple1#N/A2
89$27.00 HomeApple1#N/A1
93$9.00 HomeApple2#N/A1
105$15.00 RestaurantOrange2#N/A2
117$21.00 RestaurantOrange2#N/A1
121$3.00 RestaurantOrange2#N/A3
13#N/A#N/A1
14#N/A1

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet1

Worksheet Formulas
CellFormula
P3=SUMPRODUCT(--($L$3:$L$15378=L3),--($M$3:$M$15378=M3),--($N$3:$N$15378=N3),--($G$3:$G$15378*100000+$K$3:$K$15378>G3*100000+K3))+1
L13=NA()

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>

Array Formulas
CellFormula
Q3{=SUMPRODUCT(--IFERROR(($L$3:$L$15378=L3),0),--IFERROR(($M$3:$M$15378=M3),0),--IFERROR(($N$3:$N$15378=N3),0),--IFERROR(($G$3:$G$15378*100000+$K$3:$K$15378>G3*100000+K3),0))+1}

<thead>
</thead><tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>
 
Upvote 0
Hi Eric,

I tried reaching out to the community for additional rank help and no one could answer my question so I was hoping you might be able to help.

I am having some issues with having rank total up the values. If I needed to rank the number one restaurant visited by people who have gone there and I have multiple line items for, and will not be able to combine them, how can I make rank choose the right one?


When I do a rank it says Chinese(75 ppl), but I want the formula to say Italian (90 ppl).

RestaurantPeople there
Italian20
Greek17
Sushi40
Chinese75
Italian35
Burger17
Soup30
Mexican15
Italian35

<tbody>
</tbody>


I don't want to create a separate sumifs table as most people are recommending because the restaurants will continue to grow and then I would have to make sure that the new restaurants are in the sumifs table as well.

Any Help would be great.

Thanks,

Cale
 
Upvote 0

Forum statistics

Threads
1,216,108
Messages
6,128,872
Members
449,475
Latest member
Parik11

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