Max ifs with field not equal to list of values

mikey1987

Board Regular
Joined
Mar 22, 2013
Messages
65
Hello Excel gosu's,

I have a pickle with an excel formula, and I can't seem to find an answer anywhere.
My data looks vaguely like the data below

[TABLE="width: 192"]
<colgroup><col width="64" span="3" style="width:48pt"> </colgroup><tbody>[TR]
[TD="class: xl65, width: 64"]student[/TD]
[TD="class: xl65, width: 64"]class[/TD]
[TD="class: xl65, width: 64"]marks[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]A[/TD]
[TD="align: right"]10[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]A[/TD]
[TD="align: right"]10[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]B[/TD]
[TD="align: right"]7[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]B[/TD]
[TD="align: right"]9[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]C[/TD]
[TD="align: right"]3[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]C[/TD]
[TD="align: right"]9[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]D[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]D[/TD]
[TD="align: right"]4[/TD]
[/TR]
</tbody>[/TABLE]

Let's say I want the maximum 'marks' of student B but NOT for class A & B. (let's assume there are thousands of records)
I know I can fix this by hardcoding A, B in the MAXIFS function, but I want to read these values from a list or table.

excludeClass is a named range containing {"A";"B"}
In my head the function looks like this: {=MAXIFS(marks,student,"A",class,"<>"&excludeClass)}
That doesn't work (it says 7 instead of 4).

I then tried converting 'class' to a ones and zeroes like this
=MAXIFS(marks,student,"A",IF(ISERROR(MATCH(class,excludeClass,0)),1,0),1)
That function returns {0;0;0;0;0;0;1;1} which I wanted to filter on 1, but apparantly that doesn't work either
It gives me an embarassing #VALUE

Does anyone have a clue :confused:?

Cheers!
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Try this:

ABCDEFG
studentclassmarksStudentExcludeMax Score
AMathAMath
BMathEnglish
AEnglish
BEnglish
AHistory
BHistory
ASpanish
BSpanish

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]

[TD="align: right"][/TD]

[TD="align: center"]2[/TD]

[TD="align: right"]10[/TD]
[TD="align: right"][/TD]

[TD="align: right"]3[/TD]

[TD="align: center"]3[/TD]

[TD="align: right"]10[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: right"][/TD]

[TD="align: center"]4[/TD]

[TD="align: right"]7[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]5[/TD]

[TD="align: right"]9[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]6[/TD]

[TD="align: right"]3[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]7[/TD]

[TD="align: right"]9[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]8[/TD]

[TD="align: right"]1[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]9[/TD]

[TD="align: right"]4[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

</tbody>
Sheet2

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Array Formulas[TABLE="width: 100%"]
<thead>[TR="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]
[TH="width: 10px"]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
</thead><tbody>[TR]
[TH="width: 10px, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]G2[/TH]
[TD="align: left"]{=MAX(IF(A2:A9=E2,IF(ISERROR(MATCH(B2:B9,F2:F5,0)),C2:C9)))}[/TD]
[/TR]
</tbody>[/TABLE]
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself[/TD]
[/TR]
</tbody>[/TABLE]



I get an answer of 3. If you really mean 4, please explain how you get that value.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
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