Max IF formula

willow1985

Well-known Member
Joined
Jul 24, 2019
Messages
915
Office Version
  1. 365
Platform
  1. Windows
Hello,

I am trying to get a Max IF formula to work. At first I thought of using an index match with Max however I read online that the below formula would be a better fit:

=MAX(IF(('% Complete'!A1:A6=A1),'% Complete'!$B$1:$B$7))

I need the formula to return the Maximum percentage from the list below for each color match:

% Complete
A B
[TABLE="width: 128"]
<colgroup><col width="64" span="2" style="width:48pt"> </colgroup><tbody>[TR]
[TD="width: 64"]Red [/TD]
[TD="class: xl65, width: 64, align: right"]50%[/TD]
[/TR]
[TR]
[TD]Blue[/TD]
[TD="class: xl65, align: right"]10%[/TD]
[/TR]
[TR]
[TD]Green[/TD]
[TD="class: xl65, align: right"]90%[/TD]
[/TR]
[TR]
[TD]Yellow[/TD]
[TD="class: xl65, align: right"]50%[/TD]
[/TR]
[TR]
[TD]Red [/TD]
[TD="class: xl65, align: right"]100%[/TD]
[/TR]
[TR]
[TD]Red [/TD]
[TD="class: xl65, align: right"]75%[/TD]
[/TR]
[TR]
[TD]Yellow[/TD]
[TD="class: xl65, align: right"]25%[/TD]
[/TR]
</tbody>[/TABLE]

This is what the results should be:
A B
[TABLE="width: 128"]
<colgroup><col width="64" span="2" style="width:48pt"> </colgroup><tbody>[TR]
[TD="width: 64"]Red [/TD]
[TD="class: xl63, width: 64, align: right"]100%[/TD]
[/TR]
[TR]
[TD]Blue[/TD]
[TD="class: xl63, align: right"]10%[/TD]
[/TR]
[TR]
[TD]Green[/TD]
[TD="class: xl63, align: right"]90%[/TD]
[/TR]
[TR]
[TD]Yellow[/TD]
[TD="class: xl63, align: right"]50%[/TD]
[/TR]
</tbody>[/TABLE]


However what I get is:

[TABLE="width: 128"]
<colgroup><col width="64" span="2" style="width:48pt"> </colgroup><tbody>[TR]
[TD="width: 64"]Red [/TD]
[TD="class: xl65, width: 64, align: right"]100%[/TD]
[/TR]
[TR]
[TD]Blue[/TD]
[TD="class: xl65, align: right"]100%[/TD]
[/TR]
[TR]
[TD]Green[/TD]
[TD="class: xl65, align: right"]100%[/TD]
[/TR]
[TR]
[TD]Yellow[/TD]
[TD="class: xl65, align: right"]100%[/TD]
[/TR]
</tbody>[/TABLE]


Any help would be greatly appreciated

Thank you :)

Carla
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Re: Need help with a Max IF formula

Did you confirm the formula with Ctrl Shift Enter, rather than just enter?
If so the formula should be wrapped in {}
 
Upvote 0
Re: Need help with a Max IF formula

Another option without the need to use Ctrl Shift Enter is
=AGGREGATE(14,6,'% Complete'!$B$1:$B$7/('% Complete'!$A$1:$A$7=A1),1)
 
Upvote 0
Re: Need help with a Max IF formula

When I confirm with Shift+Ctrl+Enter I still get the incorrect results of:

[TABLE="width: 128"]
<colgroup><col width="64" span="2" style="width:48pt"> </colgroup><tbody>[TR]
[TD="width: 64"]Red [/TD]
[TD="class: xl65, width: 64, align: right"]100%[/TD]
[/TR]
[TR]
[TD]Blue[/TD]
[TD="class: xl65, align: right"]50%[/TD]
[/TR]
[TR]
[TD]Green[/TD]
[TD="class: xl65, align: right"]50%[/TD]
[/TR]
[TR]
[TD]Yellow[/TD]
[TD="class: xl65, align: right"]50%[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
Re: Need help with a Max IF formula

Carla

Try this and enter the formula with CTRL+SHIFT+ENTER.

=MAX(IF(('% Complete'!$A$1:$A$7=A1),'% Complete'!$B$1:$B$7))
 
Upvote 0
Re: Need help with a Max IF formula

You need to lock the cell ranges like


Book1
ABCDEFGH
1Red50%Red100%100%
2Blue10%Blue10%10%
3Green90%Green90%90%
4Yellow50%Yellow50%50%
5Red100%
6Red75%
7Yellow25%
Sheet1
Cell Formulas
RangeFormula
H1=AGGREGATE(14,6,$B$1:$B$7/($A$1:$A$7=F1),1)
G1{=MAX(IF($A$1:$A$7=A1,$B$1:$B$7))}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Re: Need help with a Max IF formula

Try a "regular" formula:

<table border="1" cellspacing="0" style="font-family:Calibri,Arial; font-size:11pt; background-color:#ffffff; "> <colgroup><col style="font-weight:bold; width:30px; " /><col style="width:76.04px;" /><col style="width:76.04px;" /></colgroup><tr style="background-color:#cacaca; text-align:center; font-weight:bold; font-size:8pt; "><td > </td><td >A</td><td >B</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >1</td><td >Red</td><td style="text-align:right; ">100%</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >2</td><td >Blue</td><td style="text-align:right; ">10%</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >3</td><td >Green</td><td style="text-align:right; ">90%</td></tr><tr style="height:19px ;" ><td style="font-size:8pt; background-color:#cacaca; text-align:center; " >4</td><td >Yellow</td><td style="text-align:right; ">50%</td></tr></table><br /><table style="font-family:Arial; font-size:10pt; border-style: groove ;border-color:#00ff00;background-color:#fffcf9; color:#000000; "><tr><td ><b></b></td></tr><tr><td ><table border = "1" cellspacing="0" cellpadding="2" style="font-family:Arial; font-size:9pt;"><tr style="background-color:#cacaca; font-size:10pt;"><td >Cell</td><td >Formula</td></tr><tr><td >B1</td><td >=SUMPRODUCT(MAX(('% Complete'!$A$1:$A$7=A1)*('% Complete'!$B$1:$B$7)))</td></tr></table></td></tr></table>
 
Upvote 0
Re: Need help with a Max IF formula

I find all the formulas break down when I change the parameters to: '% Complete'!$A$1:$A$1000000=A1

If I want to add more colors for example to match. If there is no match I get a #NUM ! error as well, but I am assuming this is normal? Can I fix this by incorporating an IFERROR function?

Thank you for all your guys help!

Carla
 
Upvote 0
Re: Need help with a Max IF formula

You're ranges must be the same size like
=IFERROR(AGGREGATE(14,6, 'Labor Input BLANK'!$H$3:$H$1000/('Labor Input BLANK'!$F$3:$F$1000=D2),1),"")

Also do not reference the entire column, it will simply cause Xl to slow right & probably crash.
ALWAYS limit formula ranges to the used range & a LITTLE bit extra to allow for different sized data.
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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