excelexcel-formulamaxifs

IF Duplicate value in Column B&C return the greater Price in G


SO, trying to brainstorm if this is possible. You guys are my go to. First I needed to call out the Duplicates. Which I can do and did with this formula.

=IF((B16&C16)=(B15&C15),"X",IF((B16&C16)=(B17&C17),"X",""))

But then I need to call out the greater price number out of the duplicate value? Is this possible? So like AC 41000 is a Duplicate because it shows up more than once, but I need to call out $6.42 as the higher price between the duplicate pair.

Data Sample

enter image description here


Solution

  • Try,

    =AGGREGATE(14, 6, (F$2:INDEX(F:F, MATCH(1E+99, F:F)))/((B$2:INDEX(B:B, MATCH(1E+99, F:F))=B2)*(C$2:INDEX(C:C, MATCH(1E+99, F:F))=C2)), 1)
    

    enter image description here

    At first I followed your logic but quickly realized that your formula would be better as,

    =if(countifs(B:B, B2, C:C, C2)-1, "X", "")
    

    That led me to a simple two column pseudo-MAXIFS with AGGREGATE.

    If you want to show the largest value when the row contins the highest value and an X if not then you have to double up the formula.

    =IF(AGGREGATE(14, 6, (F$2:INDEX(F:F, MATCH(1E+99, F:F)))/((B$2:INDEX(B:B, MATCH(1E+99, F:F))=B2)*(C$2:INDEX(C:C, MATCH(1E+99, F:F))=C2)), 1)=F2, AGGREGATE(14, 6, (F$2:INDEX(F:F, MATCH(1E+99, F:F)))/((B$2:INDEX(B:B, MATCH(1E+99, F:F))=B2)*(C$2:INDEX(C:C, MATCH(1E+99, F:F))=C2)), 1), "X")
    

    enter image description here