RANK segmented sales w/ SUMPRODUCT?

rails85

New Member
Joined
Mar 7, 2013
Messages
4
Hi all! I'm basically at a breaking point. I am trying to rank a file with sales by customer but the sales are broken out by a sub segment. I need to rank them at the total customer level. Below is a makeshift example of how my data looks (the rank column is the result I want):

NameSalesTotal SalesRank
A52273
B85854
C848031
D6356482
A652273
C6458031
A892273
C748031
D136482
A682273

<tbody>
</tbody>

What I'm looking for is to combine the total sales which I got with sumproduct (or sumif) and the rank into one formula.

Thanks much in advance!
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Welcome to MrExcel...

Why not create a summary table of the sales and then do the rank within this table?

Matty
 
Upvote 0
Hi all! I'm basically at a breaking point. I am trying to rank a file with sales by customer but the sales are broken out by a sub segment. I need to rank them at the total customer level. Below is a makeshift example of how my data looks (the rank column is the result I want):

NameSalesTotal SalesRank
A52273
B85854
C848031
D6356482
A652273
C6458031
A892273
C748031
D136482
A682273

<tbody>
</tbody>


What I'm looking for is to combine the total sales which I got with sumproduct (or sumif) and the rank into one formula.

Thanks much in advance!

Why not try this in Col D (assuming your headers are row 1:
=rank(c2,C$2:C$10)
 
Last edited:
Upvote 0
Thanks Bob & Matty!. But what I want to do is skip the process of making a column for total sales before I rank. I actually want the rank in column D to be in column C. I've seen it done in other forums but the difference is those ranks were done at sub class level rather than an aggregate level.
 
Upvote 0
Maybe something like this

Create a list of unique names in column E - you can achieve this easily using Data > Remove Duplicates

A
B
C
D
E
1
Name​
Sales​
Rank​
Name Unique​
2
A​
5​
3​
A​
3
B​
85​
4​
B​
4
C​
84​
1​
C​
5
D​
635​
2​
D​
6
A​
65​
3​
7
C​
645​
1​
8
A​
89​
3​
9
C​
74​
1​
10
D​
13​
2​
11
A​
68​
3​

<tbody>
</tbody>


Formula in C2 copied down
<sumif($a$2:$a$11,$e$2:$e$11,$b$2:$b$11)))+1
=SUMPRODUCT(--(SUMIF($A$2:$A$11,A2,$B$2:$B$11) < SUMIF($A$2:$A$11,$E$2:$E$11,$B$2:$B$11)))+1

Hope this helps

M.</sumif($a$2:$a$11,$e$2:$e$11,$b$2:$b$11)))+1
 
Upvote 0
Maybe something like this

Create a list of unique names in column E - you can achieve this easily using Data > Remove Duplicates

A
B
C
D
E
1
Name​
Sales​
Rank​
Name Unique​
2
A​
5​
3​
A​
3
B​
85​
4​
B​
4
C​
84​
1​
C​
5
D​
635​
2​
D​
6
A​
65​
3​
7
C​
645​
1​
8
A​
89​
3​
9
C​
74​
1​
10
D​
13​
2​
11
A​
68​
3​

<tbody>
</tbody>


Formula in C2 copied down
<sumif($a$2:$a$11,$e$2:$e$11,$b$2:$b$11)))+1
=SUMPRODUCT(--(SUMIF($A$2:$A$11,A2,$B$2:$B$11) < SUMIF($A$2:$A$11,$E$2:$E$11,$B$2:$B$11)))+1

Hope this helps

M.

Ah that's exactly the result I want. Is it to much to ask for to not have to make a unique name column? I'm building this for a larger report and the data set will change all the time (it will pull from a database). The final goal is to create an automated top and bottom 10 rank report based on total sales rank and to have that report be dynamic based on the data that's brought into it.</sumif($a$2:$a$11,$e$2:$e$11,$b$2:$b$11)))+1
 
Upvote 0
<sumif($a$2:$a$11,$e$2:$e$11,$b$2:$b$11)))+1
Ah that's exactly the result I want. Is it to much to ask for to not have to make a unique name column?

Maybe this....


A
B
C
1
Name​
Sales​
Rank​
2
A​
5​
3​
3
B​
85​
4​
4
C​
84​
1​
5
D​
635​
2​
6
A​
65​
3​
7
C​
645​
1​
8
A​
89​
3​
9
C​
74​
1​
10
D​
13​
2​
11
A​
68​
3​

Formula in C2 copied down
=SUMPRODUCT(--(SUMIF($A$2:$A$11,A2,$B$2:$B$11) < (COUNTIF(OFFSET($A$2:$A$11,,,ROW($A$2:$A$11)-ROW($A$2)+1),$A$2:$A$11)=1)*SUMIF($A$2:$A$11,$A$2:$A$11,$B$2:$B$11)))+1

M.
</sumif($a$2:$a$11,$e$2:$e$11,$b$2:$b$11)))+1
 
Upvote 0
Thanks Marcelo.. it works! Sadly, my file has about 20k lines and it took about 25 minutes to calculate. Since I'm trying to do this with a few columns I don't know if this can be implemented. What if I had a pre-build sumif formula and wanted to rank off of that?
 
Upvote 0

Forum statistics

Threads
1,214,924
Messages
6,122,293
Members
449,077
Latest member
Rkmenon

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