View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron Coderre Ron Coderre is offline
external usenet poster
 
Posts: 698
Default MAXIF style function

Even though CindyC got her answer, I thought I'd correct the 2nd formula in
my post....

This erroneous one:
=MAX(INDEX((A2:A10="Dog")*B2:B10-(A2:A10<"Dog")*MIN(B2:B10),0))

Should be this:
=MAX(INDEX((A2:A10="Dog")*B2:B10+(A2:A10<"Dog")*M IN(B2:B10),0))
.....(the "B10-" changed to "B10+")

Now the corrected formula behaves like the original ARRAY FORMULA I posted
and properly handles negative values in the Col_B range.
***********
Regards,
Ron

XL2002, WinXP


"Ron Coderre" wrote:

Here are a couple options:

This is an ARRAY FORMULA (commit with ctrl+shift+enter)
=MAX(IF(A2:A10="Dog",B2:B10))

This is a regular formula:
=MAX(INDEX((A2:A10="Dog")*B2:B10-(A2:A10<"Dog")*MIN(B2:B10),0))

Does that help?
***********
Regards,
Ron

XL2002, WinXP


"CindyC" wrote:

I need a function that works just like COUNTIF or SUMIF but is MAXIF instead.

Basically

A B
Dog 5
Dog 6
Cat 7
Bird 2
Cat 5

I want to look for Dog in Column A and get the max value associate with
those rows in Column B. I am thinking I can do this with an Array Function,
but can't seem to get my head arround it.