What I'm hearing is that you want a column for each possible service line and whether it is the primary or secondary count it and add up the total. So you are logically asking: if(contains(A, "Blue") or contains(B, "Blue"), 1, 0) and sum that up for your grouping? The easiest way to do this would ...