Search code examples
google-sheetsgs-conditional-formattinggoogle-sheets-querygoogle-sheets-formula

Conditional formatting three lowest values if cell is equal to a value


I want to highlight the rows with the three lowest values in Column D if the value in Column A is 100. For example:

Column A        D
       30       2
     **100      8**
       50       20
     **100      10**
       100      50 
     **100      12**

Solution

  • Please try selecting A1:A6 and D1:D6 then Format, Conditional formatting..., Format cells if..., Custom formula is:

    =and($A1=100,MATCH($D1,query($A$1:$D$6,"select D where A=100 order by D asc limit 3"),0))
    

    choose formatting and click Done.