Zend certified PHP/Magento developer

Highligh group of cells based on a condition – Excel

I have the following table consisting of three rows, the outcome is to highlight all cell on a single row only if more than 8 following cells has a value 1.

For example in the first row, I have 6 consecutive cells with a value 1, but since that doesn’t meet my criteria of 8 consecutive cells with value 1 it will not be highlighted. Row 2 has 8 consecutive cells (from G to N) so it gets highlighted. Row three has more than 8, so it highlights all cells until a blank row appears.

Clic to see my example table

On my data table, I will only have values of Blank or 1’s. But since the number of rows and cells is big, doing manually would take a lot of time. Do you know of a formatting formula or maybe by doing coding?