This proposal employs two helper columns (F:G) which may be moved and/or hidden for aesthetic purposes.
Column F is populated using: =IF(B4="","",ISNUMBER(MATCH(SUM(D4:E4),C$24:C$38,0)))
Column G is populated using: =IF(B4="","",OR(COUNTIFS(F$4:F$21,TRUE,B$4:B$21,B4)=COUNTIFS(B$4:B$21,B4),COUNTIFS(F$4:F$21,FALSE,B$4:B$21,B4)=COUNTIFS(B$4:B$21,B4)))
The formulas that conditionally format the cells are as follows:
Red: =AND($F4=TRUE,$G4=FALSE)
Green: =AND($F4=TRUE,$G4=TRUE)
Let us know if you have any questions.
Bookmarks