# Finding MAX value with criteria list [Solved/Closed]

Ask a question RayH 122Posts Tuesday August 31, 2010Registration date ContributorStatus June 20, 2016 Last seen - Last answered on Jun 20, 2016 at 11:14 PM by fdibbins
Hello Chaps

I don't often ask for help here but this one has stumped me.

For a dashboard of sorts...
I have a list of values in column S.
Each of these has a status value in column C.

I need to find the maximum value in column S where the status matches one in a list of statuses.
The table of valid status values is in A2:A6

So something like "=(MAX(IF(C2:C111=ValueOnStatusTable,S2:S200)))
This would work if the StatusTable was only 1 cell and matched only 1 value

A C S
X M 5
M M 8
1 1 10
2 L 13
A A 8
A 5
X 3
K 1

So, in this case the value return would 10 as its status of M is in the list
The value of 13 is not returned as its status value of L is NOT in the list

Likewise for finding the MIN value.
In that case 3 would be returned and not 1 as X is valid and K is not.

Thanks
Ray
+0
Hey Ray,

I'm just about to head off into the sunset but I was thinking that perhaps you could use the INDEX/MATCH function wrapped in the MAX function. Something like:-

=MAX(INDEX(\$C\$1:\$C\$8,MATCH(A6,\$B\$1:B\$8,0)))

assuming the values are in Columns A, B, & C.

If there isn't a matching value, it should return N/A in the column in which you place the formula. But I'm not sure if it could handle and give the right return if there is a value in the first column with two matches in the second column (such as the value "M").

Have a fiddle with it. You never know.

Formulae are not a strong point with me so where is Mazzaropi when you need him?!!?

I'm off. See ya.

Cheerio,
vcoolio.
RayH 122Posts Tuesday August 31, 2010Registration date ContributorStatus June 20, 2016 Last seen -
Hey VC,
I think the solution you gave was one of the many variants I tried already.
It does return a value but doesn't take the whole valid status table into account and returns just the first instance of the status.

Bear in mind that it should return the MAX value of all of those statuses not individually.

I'd prefer a Maserati but I'd settle for Mazzaropi right now.
+0
=(MAX(IF(C2:C111=ValueOnStatusTable,S2:S200)))
that is an ARRAY formula and needs to be entered using CTRL SHIFT ENTER, not just enter

=MAX(INDEX(\$C\$1:\$C\$8,MATCH(A6,\$B\$1:B\$8,0)))
Dont think this will work. INDEX/MATCH will return 1 value, so there will be nothing for MAX to work on.

The MAX/IF should work though
RayH 122Posts Tuesday August 31, 2010Registration date ContributorStatus June 20, 2016 Last seen -
Hi fdibbins,

Yeah, I tried that too.
What I would I put in place of ValueOnStatusTable though? Using the range of the table I get #N/A indicating that it cant find a value??

Both the Status column (C) and the ValidStatus range are formatted as Text. Sometimes this causes a problem when they are different.
+0
If the range you are trying to find the max of, is formatted as text, that is what is causing the problem - you cannot find the max of text...which is greater, blue or green?

You will need to convert those text "values" back to numbers 1st

hmm or maybe try using SUMPRODUCT()
RayH 122Posts Tuesday August 31, 2010Registration date ContributorStatus June 20, 2016 Last seen -
"Both the Status column (C) and the ValidStatus range are formatted as Text. "

The value I am trying to MAX is formatted as "General"

Given this scenario, how do I pick out those values to SUMPRODUCT with?
+0
Hi Ford,

Welcome to CCM. Glad to see you here.

I see your logic as I'm sure that Ray can. It is a tricky one though!

Over to Ray...........

Thanks Ford.

Cheerio,
vcoolio.
fdibbins 33Posts Sunday June 19, 2016Registration date ContributorStatus November 20, 2016 Last seen -
Thanks for the invite, hope I can be of help here :)
+0
Hey guys,

Try reserving an extra column for this formula:
=IF(ISERROR(VLOOKUP(C2,\$A\$2:\$A\$6,1,0)),0,1)

I placed this in column T, but you can use any column, which you can then hide or place out of sight.

=MAX((T2:T9=1)*S2:S9)
This is an array formula; confirm with Ctrl+Shift+Enter.

Best regards,
Trowa
RayH 122Posts Tuesday August 31, 2010Registration date ContributorStatus June 20, 2016 Last seen -

That works. I was hoping not to use a helper column though but I'll take what I can get at this stage.
RayH 122Posts Tuesday August 31, 2010Registration date ContributorStatus June 20, 2016 Last seen -
Those wanting to use this for MIN you have to wrap this in an IF to check for ZERO

=MIN(IF((\$T2:\$T9=1)*\$S2:\$S9>0,\$S2:\$S9))

Member requests are more likely to be responded to.

Members can monitor the statuses of their requests from their account pages.