Get Maximum value of column B, given condition in Column A

mgt

New Member
Joined
Nov 7, 2004
Messages
12
Hello,

Column A ranges from 0 to 1 for 1143 rows
Column B can be a negative to a positive number

Column A Column B
0.1
0.2
0.399 5800
0.41 8065
0.6
1.0

I can get the maximum valuue in Column B =MAX(B2:B1143) = 8065
I can get the address of that cell =ADDRESS(MATCH(MAX(B2:B1143),$B$2:B1143,0),1)

But I want only the maximum value if the corresponding value in A is <= .40, so from the example above, I want the value of 5800 returned not 8065.
Then which cell has this maximum value.

Many thanks,
:)

Margaret
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Try

=MAX(IF(A2:A1143<=0.40,B2:B1143))

Confirmed as array formula with Shift Ctrl Enter

Or if Column A is sorted ascending

=MAX(B2:INDEX(B2:B1143,MATCH(0.4,A2:A1143)))
 
Last edited:
Upvote 0
Thanks Jason.

When I try
=MAX(IF(A2:A1143<=0.40,B2:B1143))
I get the maximum value in column B of 8070 but A for that cell is .9895 rather than a value where a is <=0.4

*BUT* I get the correct value as I have A sorted when I use
=MAX(B2:INDEX(B2:B1143,MATCH(0.4,A2:A1143)))


Thanks :) :)

Margaret
 
Upvote 0
When I try
=MAX(IF(A2:A1143<=0.40,B2:B1143))
I get the maximum value in column B of 8070 but A for that cell is .9895 rather than a value where a is <=0.4

That would suggest you didn't array confirm the formula.

You need to press Shift Ctrl Enter to close the cell after you enter the formula, not just Enter.
 
Upvote 0

Forum statistics

Threads
1,224,603
Messages
6,179,850
Members
452,948
Latest member
UsmanAli786

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