sumproduct with max

BeLZeBuT

New Member
Joined
Aug 17, 2021
Messages
6
Office Version
  1. 2013
Platform
  1. Windows
Hi everyone. I would appreciate your help.

I have a workbook with multiple sheets.

in the sheet1 i must return the value from the sheet by the folowing criteria>

suppose o sheet1 i select name 'John', and from the sheet2 that has the structure, i must return the addiacent cell value (col. B), that coresponding to the max value in col. C

Book1.xlsx
ABC
1John34896553
2Mary 792416,61
3John860903,62
4Mary 901028,92
5Mary 2923,573
6John3197,571
Sheet2


in this case i want to return 3489655 (cell A2).

i can only get the max for John with formula
Excel Formula:
=SUMPRODUCT(MAX(((Sheet2!A:A=A1) * (Sheet2!C:C))))

Please help me.
3489655​
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
First, 3489655 is NOT in A2 it is in B1

In your example all your data is on Sheet2

=INDEX(Sheet2!B1:B6,MATCH(MAX(Sheet2!C1:C6),Sheet2!C1:C6,0),1)

So you don't want Mary 2923,57 ? Her value in column C is also a MAX (3)
 
Upvote 0
First, 3489655 is NOT in A2 it is in B1

In your example all your data is on Sheet2

=INDEX(Sheet2!B1:B6,MATCH(MAX(Sheet2!C1:C6),Sheet2!C1:C6,0),1)

So you don't want Mary 2923,57 ? Her value in column C is also a MAX (3)
You missed in formula to get only 'John's max(3)
 
Upvote 0
It's not clear from your description exactly what you want.

It looks like you want the value from column B that is adjacent to the maximum value in column C
The maximum number in column C is 3 (both John and Mary have this in column C).
The number adjacent to that in column B for John is 3489655
The formula returns 3489695.
 
Upvote 0
It's not clear from your description exactly what you want.

It looks like you want the value from column B that is adjacent to the maximum value in column C
The maximum number in column C is 3 (both John and Mary have this in column C).
The number adjacent to that in column B for John is 3489655
The formula returns 3489695.
Sorry for my bad english.

the formula must return the value from column B form max in column C for specific name John or Mary
In sheet1 if i change 'John' with 'Mary' the formula must return 2923,57
 
Upvote 0
Ah, ok I think I have this now.
If you select John you want John's column B that relates to his max
But if you select Mary you want her column B that relates to her max

I have selected John or Mary in Sheet1!A1, change the formula to reflect where you select John and Mary

in Sheet1!B1
=INDEX(Sheet2!B1:B6,MATCH(MAX(Sheet2!C1:C6),IF(A1=Sheet2!A1:A6,Sheet2!C1:C6)),1)

NOTE: This is an array formula, use CTRL-SHIFT-ENTER when entering the formula, not just ENTER
 
Upvote 0
Ah, ok I think I have this now.
If you select John you want John's column B that relates to his max
But if you select Mary you want her column B that relates to her max

I have selected John or Mary in Sheet1!A1, change the formula to reflect where you select John and Mary

in Sheet1!B1
=INDEX(Sheet2!B1:B6,MATCH(MAX(Sheet2!C1:C6),IF(A1=Sheet2!A1:A6,Sheet2!C1:C6)),1)

NOTE: This is an array formula, use CTRL-SHIFT-ENTER when entering the formula, not just ENTER
For Mary result is ok, but not for John. You try this for John.

In your formula you first get the max of column C, but i'm not sure is correct. Maybe a case that the max of Mary in col. C is 4, but for John the max is 3.
 
Upvote 0
Try this:

=MOD(AGGREGATE(14,6,(Sheet2!$C$1:$C$6*10^10+Sheet2!$B$1:$B$6)/(Sheet2!$A$1:$A$6="John"),1),10^10)
 
Upvote 0
Another approach

BeLZeBuT.xlsm
ABC
1John34896553
2Mary792416.61
3John860903.62
4Mary901028.92
5Mary2923.573
6John3197.571
Sheet2


BeLZeBuT.xlsm
AB
1John3489655
2Mary2923.57
Sheet1
Cell Formulas
RangeFormula
B1:B2B1=INDEX(Sheet2!B:B,AGGREGATE(14,6,ROW(Sheet2!B$1:B$10)/(Sheet2!A$1:A$10=A1)*(Sheet2!C$1:C$10=AGGREGATE(14,6,Sheet2!C$1:C$10/(Sheet2!A$1:A$10=A1),1)),1))
 
Upvote 0

Forum statistics

Threads
1,214,377
Messages
6,119,183
Members
448,872
Latest member
lcaw

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