Page 634 - Excel 2013 All-in-One For Dummies
P. 634
616 Filtering Data
Figure 2-5:
Copied records for the Boston location where the date hired is before January 1, 2000.
When you enter two or more criteria in different rows of the Criteria Range, Excel treats the criteria as a logical OR and selects records that meet any one of the criteria they contain. Figure 2-6 shows you an example of the results of a query using an OR condition. In this example, Excel has copied records where the location is either Boston or San Francisco because Boston is entered under the Location field name in the second row (row 2) of the Criteria Range above San Francisco entered in the third row (row 3).
When creating OR conditions, you need to remember to redefine the Criteria Range to include all the rows that contain criteria, which in this case is
the cell range L2:U3. (If you forget, Excel uses only the criteria in the rows included in the Criteria range.)
When setting up your criteria, you can combine logical AND and logical OR conditions (again, assuming that you expand the Criteria Range sufficiently to include all the rows containing criteria). For example, if you enter Boston in cell R2 (under Location) and <1/1/00 in cell S2 (under Date Hired) in
row 2 and enter San Francisco in cell R3 and then repeat the query, Excel copies the records where the location is Boston and the date hired is before January 1, 2000, as well as the records where the location is San Francisco (regardless of the date hired).