A somewhat more simple approach to this actual case:
The OP is setting the colours of all cells to one of two different colours to highlight failures. More efficient would be letting the default BG colour be white and just update the yellow cells (bool is false) in a case structure.