Restricting Index Match to search only within a range of values

yolkrule

New Member
Joined
Jun 3, 2015
Messages
2
Hi all,

I am trying to get excel to return index match max values for me only when the column x values equal a certain number. I initially thought nesting the index match within an if statement would work, but the if does not limit the index match, it only checks to see that column x has the values specified. For example:

=IF($H$5:$H$1048576=5,(INDEX($D$5:$D$1048576,MATCH(MAX($I$5:$I$1048576),$I$5:$I$1048576,0),0)),0)

My current formula checks column H for the value 5 - if there is a 5, the index formula will return the max. However, I only want it to return the max value within all the 5s. Any ideas how I can do this?

Any response is appreciated. Thanks!
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
This is an array formula - must be confirmed with ctrl+shift+enter, not just enter.
Code:
=INDEX($D$5:$D$1048576,MATCH(MAX(IF($H$5:$H$1048576=5,$I$5:$I$1048576,0)),$I$5:$I$1048576,0),)
 
Upvote 0
What happens if the MAX value occurs more than once in $I$5:$I$1048576 corresponding to $H$5:$H$1048576 equaling 5?
 
Upvote 0

Forum statistics

Threads
1,214,865
Messages
6,121,988
Members
449,060
Latest member
mtsheetz

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