Difficult Ranking Problem

easybpw

Active Member
Joined
Sep 30, 2003
Messages
439
Office Version
  1. 365
  2. 2013
Platform
  1. Windows
Hi everyone,

Thanks in advance for the help. I am trying to rank a column based on specific criteria. I have it working up to a point. See below. As you can see I am ranking A, B, C, etc. based on the column that starts with 23.91. The column to the right of the B works fine, it is ranking everything based on the letter. =IF($O3=" "," ",SUMPRODUCT((O3=$O$3:$O$2000)*(J3<$J$3:$J$2000))+1). Column O is the letters, and J is 23.91. I then tried to rank just by the letters and don't want to include the dollar amounts for any other letter but this formula =IF($O3="A",RANK.EQ(P3,$P$3:$P$703,1)," ") is including them. As you can see below 22.55 should be ranked 2 and 22.33 should be and so on but it's not. What can I do to get it the way I need?

1661352535944.png
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Can you post some sample, to save us from having to re-create it.

MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.
 
Upvote 0
Hi and thank you for the response. Due to work restrictions I had a hard time with your request but was able to create a dummy file that has the same scenario and problem. As you can see I want to rank each sales category by itself and I did accomplish this but the ranking is taking into consideration all sales.

Sales Analysis.xlsx
ABCDEFGHIJ
1Date of SaleTypeMarket ShareCategorySale RankOutside Sale RankInternal Sale RankDonationsCoWorker SalesMisc. Sales
27/28/2022Outside22.50A26
37/29/2022Internal22.22B1 1
47/20/2022Internal18.20B4 15
57/21/2022Outside26.00A11
68/1/2022Coworker21.25D1 1
78/2/2022Misc.3.21E3 11
88/2/2022Donation5.00C3 11
98/4/2022Coworker7.00D2 6
108/5/2022Misc.4.20E2 6
118/6/2022Internal18.22B3 11
128/7/2022Internal19.64B2 6
138/8/2022Outside22.10A415
148/9/2022Donation8.20C1 1
158/10/2022Outside22.20A311
168/11/2022Donation7.20C2 6
178/12/2022Misc.6.00E1 1
188/12/2022Outside19.90A517
Sheet1
Cell Formulas
RangeFormula
D2:D18D2=IF($B2="Outside","A",IF($B2="Internal","B",IF($B2="Donation","C",IF($B2="Coworker","D",IF($B2="Misc.","E")))))
E2:E18E2=IF($D2=" "," ",SUMPRODUCT((D2=$D$2:$D$18)*(C2<$C$2:$C$18))+1)
F2F2=IF($D2="A",RANK.EQ($E2,$E$2:$E$18,1)," ")
G2:G18G2=IF($D2="B",RANK.EQ($E2,$E$2:$E$18,1)," ")
H2:H18H2=IF($D2="C",RANK.EQ($E2,$E$2:$E$18,1)," ")
I2:I18I2=IF($D2="D",RANK.EQ($E2,$E$2:$E$18,1)," ")
J2:J18J2=IF($D2="E",RANK.EQ($E2,$E$2:$E$18,1)," ")
F3:F18F3=IF($D3="A",RANK.EQ(E3,$E$2:$E$18,1)," ")
 
Upvote 0
Thanks for that.
How about for F2
Excel Formula:
=IF($D2="A",SUMPRODUCT(($D2=$D$2:$D$18)*($E2>$E$2:$E$18))+1,"")
 
Last edited:
Upvote 0
Or maybe just
Excel Formula:
=IF($D2="A",$E2,"")
 
Upvote 0
Thanks for the help. This almost works like I need it to. And honestly, the 2nd formula you provided is the easiest, which sometimes is the less obvious. My only issue is if column B has the same number for the same category. I don't want the same rank. So for example if outside sales had 2 days at 25% and that was the top number I don't want 2 ranks of 1. The first would be 1 and then the 2nd would be 2 etc.
 
Upvote 0
So for example if outside sales had 2 days at 25% and that was the top number I don't want 2 ranks of 1.
But that's what the formula in col E will give you.
 
Upvote 0
Yes, true. But there are other outside workbooks and formulas on different sheets that columns F, G, H, & I are included in and I can't mix categories together. If I strictly use column E then I can't separate out the categories. Hope that makes sense.
 
Upvote 0
But you originally said that you wanted to ignore the prices & use the rank.
 
Upvote 0
I am getting myself a bit confused. I apologize. You all are the experts here. Ultimately what I need is to rank each "Type" column B by the Market Share, column C. While I did that in column D, Category, I need to have the rank for each type in it's own column on the spreadsheet. If I need to change some of how I have it set up I can do that. But I thought using the category column would make it easier to accomplish what I need.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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