Excel: Database Extract Only Extracts One Record

Last reviewed: November 3, 1994
Article ID: Q78022
The information in this article applies to:
  • Microsoft Excel for Windows, versions 2.x, 3.0, 4.0
  • Microsoft Excel for OS/2, versions 2.2, 2.21 and 3.0

SUMMARY

To extract records from a Microsoft Excel database, the database, criteria and extract ranges must be separate. If you attempt to extract records into the criteria range, the first record will be extracted, whether it meets the criteria or not. Other records that match the first record may also be extracted.

WORKAROUND

To avoid this behavior, copy the database field headings to a third location and and define them as the extract range.

MORE INFORMATION

The Extract command clears the cells below the extract range before performing the extract. This process creates a blank criteria range, causing the first record to be extracted. The procedure is then repeated, but because there is now data in the criteria range (the first record), no more records are extracted unless the database contains duplicates of the first record.

Example

  1. Enter the following in a worksheet:

          A1: NAME                B1: AGE
          A2: Tom                 B2: 30
          A3: Jane                B3: 40
    
    

  2. Select the cell range A1:B3. From the Data menu, choose Set Database.

  3. Select the cell range A1:B1. From the Edit menu, choose Copy.

  4. Select cell D1. Press the ENTER key to paste the field names.

  5. Enter "40" (without the quotation marks) in cell E2.

  6. Select the cell range D1:E2. From the Data menu, choose Set Criteria.

  7. Select the cell range D1:E1. From the Data menu, choose Extract.

Only the first record in the database is extracted.

REFERENCES

"Microsoft Excel User's Guide, Book 1," version 4.0, pages 327-343.

"Microsoft Excel User's Guide," version 3.0, pages 369-383.

"Microsoft Excel for Windows Reference Guide," version 2.1, pages 177-186.


KBCategory: kbusage
KBSubcategory:

Additional reference words: 2.0 2.00 2.01 2.1 2.10 2.2 2.20 2.21 3.0
3.00 4.0 4.00


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: November 3, 1994
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.