If I understand correctly the color needs to be applied to the merged cells in row 20. There are two conditional formatting rules based on the following formulas. For Red fill:
Formula:
=OR(COUNTIFS(AA$14:AA$64,"H",AB$14:AB$64,"Red")>0,IFERROR(AND(COUNTIFS(AA$14:AA$64,"H",AB$14:AB$64,"Amber")>=2,COUNTIFS(AA$14:AA$64,"H",AB$14:AB$64,"Amber")/COUNTIF(AA$14:AA$64,"H")>=0.5),FALSE),IFERROR(AND(COUNTIFS(AA$14:AA$64,"M",AB$14:AB$64,"Red")>=3,COUNTIFS(AA$14:AA$64,"M",AB$14:AB$64,"Red")/COUNTIF(AA$14:AA$64,"M")>=0.7),FALSE),IFERROR(AND(COUNTIFS(AA$14:AA$64,"H",AB$14:AB$64,"Amber")/COUNTIF(AA$14:AA$64,"H")<=0.5,COUNTIFS(AA$14:AA$64,"M",AB$14:AB$64,"Red")/COUNTIF(AA$14:AA$64,"M")>=0.7),FALSE))
For Amber fill:
Formula:
=OR(COUNTIFS(AA$14:AA$64,"H",AB$14:AB$64,"Amber")>0,COUNTIFS(AA$14:AA$64,"H",AB$14:AB$64,"Red")>0,IFERROR(AND(COUNTIFS(AA$14:AA$64,"M",AB$14:AB$64,"Amber")>=3,COUNTIFS(AA$14:AA$64,"M",AB$14:AB$64,"Amber")/COUNTIF(AA$14:AA$64,"M")>=0.5),FALSE),IFERROR(AND(COUNTIFS(AA$14:AA$64,"L",AB$14:AB$64,"Red")>=2,COUNTIFS(AA$14:AA$64,"L",AB$14:AB$64,"Red")/COUNTIF(AA$14:AA$64,"L")>=0.7),FALSE),IFERROR(AND(COUNTIFS(AA$14:AA$64,"M",AB$14:AB$64,"Amber")/COUNTIF(AA$14:AA$64,"M")<=0.5,COUNTIFS(AA$14:AA$64,"L",AB$14:AB$64,"Amber")/COUNTIF(AA$14:AA$64,"L")>=0.7),FALSE))
The cells have green fill applied as a default which will remain unless overridden by one of the other two rules.
Let us know if you have any questions.
Bookmarks