Finding best selling item by sum of sales, for each salesperson

ksscott

New Member
Joined
Mar 7, 2023
Messages
4
Office Version
  1. 365
Platform
  1. Windows
I am working in Excel 365 and have the following problem: Let's say my data is as follows:
ABC
1SalespersonProduct SoldValue
2BobShoes
56​
3BillShoes
41​
4JackSocks
47​
5BobSocks
34​
6BobPants
61​
7JackShoes
68​
8BillPants
52​
9JackSocks
85​
10BillSocks
64​
11JackSocks
37​
12BillPants
55​
13BobPants
13​

Now, for a unique list of salespeople, I'd like to get their best selling product, by sum of Value.
For Bob, this would be Pants. I tried doing SORTBY by sum of Value but it doesn't accept the sum.
Excel Formula:
=SORTBY(UNIQUE(FILTER(B:B,$A:$A="Bob")),SUM($C:$C),-1)

I have data from hundreds of salespeople and hundreds of products so it's not practical to do SUMIFS etc. Thank you for any help.
 
Hi & welcome to MrExcel.
How about
Excel Formula:
=LET(u,UNIQUE(FILTER(B:B,$A:$A="Bob")),TAKE(SORTBY(u,SUMIFS($C:$C,A:A,"Bob",B:B,u),-1),1))
 
Upvote 0
Another option for all the names
Fluff.xlsm
ABCDEF
1SalespersonProduct SoldValue
2BobShoes56BobPants
3BillShoes41BillPants
4JackSocks47JackSocks
5BobSocks34
6BobPants61
7JackShoes68
8BillPants52
9JackSocks85
10BillSocks64
11JackSocks37
12BillPants55
13BobPants13
14
View
Cell Formulas
RangeFormula
E2:F4E2=LET(u,UNIQUE(FILTER(A2:A100,A2:A100<>"")),HSTACK(u,MAP(u,LAMBDA(x,LET(mu,UNIQUE(FILTER(B2:B100,A2:A100=x)),TAKE(SORTBY(mu,SUMIFS($C:$C,A:A,x,B:B,mu),-1),1))))))
Dynamic array formulas.
 
Upvote 0
Thank you very much. I get a #NAME? Error with both of those solutions unfortunately. Maybe my Excel doesn't have the features that would allow that function.
 
Upvote 0
Ok, does this work for you
Excel Formula:
=LET(u,UNIQUE(FILTER(B:B,$A:$A="Bob")),INDEX(SORTBY(u,SUMIFS($C:$C,A:A,"Bob",B:B,u),-1),1))
 
Upvote 0
Solution
That works, thank you!
I tried for hours to do this today. Thank you again.
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

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