SUMPRODUCT with MIN and MAX?

iggydarsa

Well-known Member
Joined
Jun 28, 2005
Messages
1,780
Office Version
  1. 2019
Platform
  1. Windows
Hi All,

I have a table on Sheet1 that looks like this:


Company --- User --- Count --- %
CompA --- UserA --- 100 --- 0
CompB --- UserB --- 50 --- 25
CompC --- UserA --- 75 --- 10
CompD --- UserC --- 50 --- 20
CompE --- UserB --- 25 --- 25
CompF --- UserC --- 50 --- 10
CompG --- UserB --- 10 --- 50



On Sheet2 I have this and need a formula to get the value from Sheet1:

User --- Company with lowest %
UserA --- [Need formula here]
UserB --- [Need formula here]
UserC --- [Need formula here]


The rule is find the Company that User works for with the lowest percantage. If there are multiple records with the lowest % then get the one with the highest count.

So the outcome should look like this:

User --- Company with lowest %
UserA --- CompA
UserB --- CompB (Company B and E has the lowest % but B has the highest count)
UserC --- CompF

I know SUMPRODUCT returns number so it might not work to get the company name.

PS: for this thing I'm working on Pivot tables wont help.

Any help is greatly appreciated.
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Try this array formula


Book1
ABCD
1CompanyUserCount%
2CompAUserA1000
3CompBUserB5025
4CompCUserA7510
5CompDUserC5020
6CompEUserB2525
7CompFUserC5010
8CompGUserB10050
Sheet1



Book1
AB
1Userlowest %
2UserACompA
3UserBCompB
4UserCCompF
Sheet2
Cell Formulas
RangeFormula
B2{=INDEX(Sheet1!$A$1:$A$8,MAX((Sheet1!$B$2:$B$8=A2)*(Sheet1!$C$2:$C$8=MAX(IF(Sheet1!$B$2:$B$8=A2,IF(Sheet1!$D$2:$D$8=MIN(IF(Sheet1!$B$2:$B$8=A2,Sheet1!$D$2:$D$8)),Sheet1!$C$2:$C$8))))*(Sheet1!$D$2:$D$8=MIN(IF(Sheet1!$B$2:$B$8=A2,Sheet1!$D$2:$D$8)))*(ROW(Sheet1!$A$2:$A$8))))}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
This is a case where using a helper column can really simplify things. Consider:


Book1
ABCDEFGH
1CompanyUserCountPercentRankUserCompany w/ lowest %
2CompAUserA10001UserACompA
3CompBUserB50251UserBCompB
4CompCUserA75102UserCCompF
5CompDUserC50202
6CompEUserB25252
7CompFUserC50101
8CompGUserB10503
Sheet3
Cell Formulas
RangeFormula
H2=INDEX(A:A,AGGREGATE(15,6,ROW($A$2:$A$8)/($B$2:$B$8=G2)/($E$2:$E$8=1),1))
E2=COUNTIFS(B:B,B2,D:D,"<"&D2)+COUNTIFS(B:B,B2,D:D,D2,C:C,">"&C2)+1
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,728
Members
448,987
Latest member
marion_davis

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