Forum Discussion

HanyTaha's avatar
HanyTaha
Copper Contributor
Feb 03, 2024
Solved

color a column based on values of another column

I have the following table in MS office 2016 (excel) to record the work violation

 

No.person IDviolationseverity
11234violation 1high
21234violation 2high
31234violation 3low

 

I need to color the person ID column based on the severity column.

for example, if a person has 2 or more violations with high severity, the person ID column is colored red.

 

How can I do that?

Thanks :hearteyes:

  • HanyTaha 

    For this scenario you can apply this rule for conditional formatting:

    =AND(COUNTIFS($B$2:$B$6,B2,$D$2:$D$6,"high")>1,D2="high")

     

4 Replies

  • HanyTaha 

    =COUNTIFS($B$2:$B$6,B2,$D$2:$D$6,"high")>1

    You can apply this rule for conditional formatting

    =$B$2:$B$6

    and this range the format applies to.

    • HanyTaha's avatar
      HanyTaha
      Copper Contributor

      OliverScheurich 

      Thanks for replying.

      Not that exactly what I meant.

      I need to highlight 1234 only if its severity is high only.

      But in the photo attached, 1234 is highlighted even though its severity is low 

       

      Thanks 

      • OliverScheurich's avatar
        OliverScheurich
        Gold Contributor

        HanyTaha 

        For this scenario you can apply this rule for conditional formatting:

        =AND(COUNTIFS($B$2:$B$6,B2,$D$2:$D$6,"high")>1,D2="high")

         

Resources