See post #22, where I had you substitute:
if not compareVal in ['KA', 'KP', 'PA', 'PP']:
fieldName = 'Grade_' + str(int(compareVal))
elif not compareVal in ['PA', 'PP']:
fieldName = 'Grade_K'
count += row.getValue(fieldName)
Then, what I meant was if you have other qualifying values you explicitly want to filter, as in 'K', 'P', 'Kitchen Sink', 'other', then you should modify the code accordingly to adjust the numbers:
if not compareVal in ['KA', 'KP', 'PA', 'PP', 'K', 'P', 'Kitchen Sink', 'other']:
fieldName = 'Grade_' + str(int(compareVal))
elif not compareVal in ['PA', 'PP', 'P', 'any other preschool']:
fieldName = 'Grade_K'
count += row.getValue(fieldName)
If that's somehow mixed up in the result or still confusing, please include a more complete representative sample attachment....Another thing you can do is just in case you have more unexpected text values, those you did not anticipate (such as something coded incorrectly), you can summarize your Students point table on those codes in order to 'see' all the unique values (and then either correct them or accomodate them).Hope that helps.Enjoy,Wayne