Note the purpose of this example is to how one way to "normalize" data when the order of values is random. There are many ways to approach this problem.
The formula in G6 relies on the COUNTIF function to count the presence of a given class (i.e. "math", art", etc.) in a columns C through F:
Class names are pulled from row 5, and references are mixed to allow the formula to be copied across and down the table.
When COUNTIF finds a class in the range, it returns a positive number . The IF function will evaluate any positive result as TRUE and return "x". If a class isn't found, COUNTIF will return zero and IF will return an empty string ("").
Formula to count enrollment
The formula used in row 4 to count students in each class looks like this:
The structured reference is added automatically in this case since all data is in a table. The equivalent formula without structured references is: