Group Comparisons Using Parenthesis
By using the AND and OR operators, you can accomplish a great deal. However, there are limitations in using just these two operators. A formula is evaluated from left to right. This poses no problem in the formula below.
BirthDate<6/30/1995 AND InitIEPClassifDate>=1/1/2003 AND InitIEPClassifDate<=12/31/2003
However, when OR statements are used this causes problems. Consider the statement:
BirthDate>6/30/1995 OR InitIEPClassifDate<1/1/2004 AND Sex=Male
You might look at this statement and decide that any male student whose birth date was after 6/30/1995 or whose classification date was before 1/1/2004 would be counted. However, this is not the case. The formula will be read from left to right and so any student of any gender whose birth date is before 6/30/1995 will be included, as will any male student whose initial classification date was before 1/1/2004, regardless of birth date.
In order to select all male students with birth dates after 6/30/1995 and classification dates before 1/1/2004, the formula must be written using parentheses as follows:
(BirthDate>6/30/1995 OR InitIEPClassifDate<1/1/2004) AND Sex=Male
This formula will first check to see if the students birth date is after 6/30/1995 or if the classification date is before 1/1/2004. If either of these statements are true (you used an OR here), then the student will have met these criteria. Then, the formula will check the other criteria—sex=male—and see if it meets that criteria too. Thus, any male student whose birth date is after 6/30/1995 or whose classification date is before 1/1/2004 will be included in this report.
Sometimes it is necessary to use multiple sets of parentheses. For example, if you wanted to further restrict the statement to include only 5th graders whose ethnicity is Asian. That part of the statement is simple enough:
Grade=05 AND Ethnic=Asian
If you combine this part of the statement, bracketed by parentheses, to the rest of the statement using an AND, your resulting formula is:
(BirthDate>6/30/1995 OR InitIEPClassifDate<1/1/2004) AND Sex=Male AND (Grade=05 AND Ethnic=Asian)
Only students who meet the three parts of this statement will be included: students whose birth date is after 6/30/1995 or whose classification date is before 1/1/2004, whose sex is male, and who are in 5th grade and ethnicity is Asian.