XL3/XL4: Including or Excluding a List of Records in ExtractLast reviewed: February 2, 1998Article ID: Q103708 |
The information in this article applies to:
SUMMARYWhen you extract records from a database in Microsoft Excel, you specify criteria that you want the extracted records to meet. In cases where you have a list of matches that you want to include or exclude in your final extract, use the MATCH() function as a computed criterion. To include a list of matches, use the following formula:
=MATCH(firstcell,matchlist,0)To exclude a list of matches, use the following formula
=ISNA(MATCH(firstcell,matchlist,0))where firstcell is the first cell in the field of your database that you want to match.
MORE INFORMATIONWhen you have only a few matches for a given field, you can set up an "and" relationship using comparison criteria by entering an instance of the field name for each match you want to make. For example, if one of the fields in your database is a Name field and you want to find or extract a specific list of names, the criteria range (F1:H2) might appear as follows:
F1: Name G1: Name H1: Name F2: Ann G2: Fred H2: BobOr, you can use the AND() function as a computed criterion as follows
F1: CompCrit F2: =AND(A2="Ann",A2="Fred",A2="Bob")where column A contains the Name field in your database, cell A2 contains the first name in the field, and the criteria range is defined as F1:F2. Note that when you specify a computed criterion, the cell above the formula cannot contain the actual field name; it must either be blank or contain a different text string. If, however, you have several names that you want to match, you can list them in a vertical cell range as follows:
H1: Ann H2: Fred H3: Bob H4: Kristi H5: NikkiYou can then use the MATCH() function as a computed criterion, as in the following example (where cells F1:F2 are the criteria range):
F1: F2: =MATCH(A2,$H$1:$H$5,0)NOTE: Your matchlist must be an absolute reference or a defined name. To extract all of the records EXCEPT those in H1:H5, nest the MATCH() function within the ISNA() function.
REFERENCES"User's Guide 1," version 4.0, pages 330-337 "Function Reference," version 4.0, pages 248, 267
|
Additional query words: 3.00 4.00 4.00a howto exclusionary exception
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |