Search code examples
excelexcel-formula

Format smallest value in range of same category in Excel


I have a table with the unit prices of various articles (products) of various stores. I want to highlight the smallest value of a given product across all stores. I have already achieved this, using conditional formatting with the custom formula =AND(B2=MIN($B2:$D2), B2 <> "") in the range =$B$2:$D$4 for the following Excel spreadsheet:

enter image description here

As you can see, it works. But now I have a new problem. I want to add a column for the category of the product, and highlight the cheapest product across all stores and across the category. In this way, I can know, for example, the cheapest brand of cheese in all stores. The following table shows how I'd like it to behave:

enter image description here

I tried =AND(A2=$A$2:$A$7, C2=MIN($C2:$E2), C2 <> "") in the range =$C$2:$E$7, but it doesn't work.

Markdown table

Category Article Store 1 Store 2 Store 3
Cat 1 Product 1 $30.00 $35.00 $27.00
Cat 1 Product 2 $29.00 $24.00 $25.00
Cat 1 Product 3 $32.00 $33.00 $35.00
Cat 2 Product A $4.00 $4.30 $4.50
Cat 2 Product B $5.00 $5.50 $4.50
Cat 2 Product C $3.50 $4.00 $3.75

Solution

  • You can apply the following conditional formatting rule to C2:E7:

    =C2=MIN(FILTER($C$2:$E$7,$A$2:$A$7=$A2))
    

    enter image description here