match max if

frsm

Active Member
Joined
Jun 19, 2006
Messages
258
hello all

i want to correct this formula to match my need , i want to find the value in range (b4:b405)which match the maximum value in d4:d405 when the value in c4:c405 = I4

my formula is =MAX(IF($C$4:$C$405=$I4;D$4:D$405)) and i confirm with ctrl+shift +enter

thank you
 
Yea, I was just thinking to myself "wait that wont work if you use text values" .. disregard my last post then and use Mackers formula
 
Upvote 0

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Not sure if this is the problem, but when you match a MAX value based on a criteria, you need to use the IF() in both the first and second argument of the match.

Rep added, if for no other reason then it's simply astonishing how many people make the mistake of not realising this.

I think that approximately 3 out of every 4 solutions I see posted to a MAX with criteria question are erroneous due to this omission.

I actually prefer the non-array alternative which I illustrate here:

Return Entry Corresponding to Maximum Value Based on Conditions « EXCELXOR

which also contains an example illustrating why the conditional statements are also required within MATCH's lookup_array, as you rightly point out.

However, it should be noted that this alternative cannot be so readily amended to work for the minimum.

Regards
 
Upvote 0
Rep added, if for no other reason then it's simply astonishing how many people make the mistake of not realising this.

I think that approximately 3 out of every 4 solutions I see posted to a MAX with criteria question are erroneous due to this omission.

I actually prefer the non-array alternative which I illustrate here:

Return Entry Corresponding to Maximum Value Based on Conditions « EXCELXOR

which also contains an example illustrating why the conditional statements are also required within MATCH's lookup_array, as you rightly point out.

However, it should be noted that this alternative cannot be so readily amended to work for the minimum.

Regards

Thanks - I can't take all the credit as your (great) blog is the reason I knew of this in the first place, and I was just trying to spread the knowledge as the error is quite insidious. I've checked other peoples' workings before and it's clear that because the first rows generally return the correct results they did not pick up the errors.

Regarding the alternative construction: as other people check the workings on my spreadsheets I tend to shy away from using the lookup/frequency combination as it is very difficult to understand at first glance (especially as some people don't know what frequency does), whereas most people are fairly familiar with index and match.

All the best

Mackers
 
Upvote 0
Thanks - I can't take all the credit as your (great) blog is the reason I knew of this in the first place

Very kind of you to say so! :)

I've checked other peoples' workings before and it's clear that because the first rows generally return the correct results they did not pick up the errors.

Yes - I think that's half the issue. The probability of the incorrect set-up giving a correct return by pure fortune is often quite high, and so it goes unnoticed.

Regarding the alternative construction: as other people check the workings on my spreadsheets I tend to shy away from using the lookup/frequency combination as it is very difficult to understand at first glance (especially as some people don't know what frequency does), whereas most people are fairly familiar with index and match.

Agreed. It is certainly less comprehensible, so I completely understand your sentiments in that respect.

Cheers
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,183
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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