you could maybe work out a solution by sorting your input table and using peek() function to check for a change in values, like
if(peek(ProdGroup) <> ProdGroup, 1,
if(peek(Size)<>Size, 3)))) as Expressioncheck
resident Sheet1$ order by ProdGroup, Color asc, Size asc;
drop table Sheet1$;
It's kind of unclear to me if a check on change in value is sufficient (Above will e.g. only work if you need to check for a new Size for the same Color, not for a global new Size over all Colors) or if you need to do something more complex.
Above reproduces your expected outcome and may serve you as a starting point.
Hope this helps,
edit: If you have loaded the table in above sorted order, you could also use as expression in your table: