Microsoft KB Archive/24666: Difference between revisions

From BetaArchive Wiki
(importing KB archive)
 
m (Text replacement - """ to """)
 
Line 13: Line 13:
To extract records from a Microsoft Excel for the Macintosh version 1.0. 1.03, 1.04, 1.06, 1.5, 2.2, or 3.0 database based on whether a field in the record contains a number or text, use a computed criteria with the TYPE function.
To extract records from a Microsoft Excel for the Macintosh version 1.0. 1.03, 1.04, 1.06, 1.5, 2.2, or 3.0 database based on whether a field in the record contains a number or text, use a computed criteria with the TYPE function.


For example, to find all records that contain a number in the "CODE" field of the following database, a computed criteria has been created in E1:E2:
For example, to find all records that contain a number in the "CODE" field of the following database, a computed criteria has been created in E1:E2:


<pre>  +---+-----------+----------+---+-------------+
<pre>  +---+-----------+----------+---+-------------+
Line 29: Line 29:
   +---+-----------+----------+---+-------------+
   +---+-----------+----------+---+-------------+
</pre>
</pre>
To find all records that contain a text string in the &quot;CODE&quot; field of the database, you must enter the formula =TYPE(B2)=2 in cell E2 of the computed criteria.
To find all records that contain a text string in the "CODE" field of the database, you must enter the formula =TYPE(B2)=2 in cell E2 of the computed criteria.
To define the criteria range, select cells E1:E2 and choose Set Criteria from the Data menu.
To define the criteria range, select cells E1:E2 and choose Set Criteria from the Data menu.


Line 37: Line 37:


# The field name of the computed criteria must be different from any of the field names in the database. In the above example, E1 is left blank.
# The field name of the computed criteria must be different from any of the field names in the database. In the above example, E1 is left blank.
# You must use a relative reference to the first record in the field of the database you want to reference in the formula. For example, B2 is a relative reference to the first record in the &quot;CODE&quot; field in the formula =TYPE(B2)=1.
# You must use a relative reference to the first record in the field of the database you want to reference in the formula. For example, B2 is a relative reference to the first record in the "CODE" field in the formula =TYPE(B2)=1.


For more information on the TYPE function, see page 240 of the &quot;Microsoft Excel Function Reference&quot; version 3.0 manual. If you are using Excel 2.2, see page 88 of the &quot;Microsoft Excel Functions and Macros&quot; version 2.2 manual.
For more information on the TYPE function, see page 240 of the "Microsoft Excel Function Reference" version 3.0 manual. If you are using Excel 2.2, see page 88 of the "Microsoft Excel Functions and Macros" version 2.2 manual.
Note: This information also applies to Microsoft Excel for Windows versions 2.1, 2.1c, and 3.0, and to Microsoft Excel for OS/2 versions 2.2, 2.21, and 3.0.
Note: This information also applies to Microsoft Excel for Windows versions 2.1, 2.1c, and 3.0, and to Microsoft Excel for OS/2 versions 2.2, 2.21, and 3.0.
|}
|}

Latest revision as of 12:50, 21 July 2020


Excel: Creating Criteria to Find Numbers or Text in Field

Last reviewed: October 31, 1994
Article ID: Q24666

SUMMARY

To extract records from a Microsoft Excel for the Macintosh version 1.0. 1.03, 1.04, 1.06, 1.5, 2.2, or 3.0 database based on whether a field in the record contains a number or text, use a computed criteria with the TYPE function.

For example, to find all records that contain a number in the "CODE" field of the following database, a computed criteria has been created in E1:E2:

   +---+-----------+----------+---+-------------+
   |   |     A     |     B    | D |      E      |
   +---+-----------+----------+---+-------------+
   | 1 | NAME      | CODE     |   |             |
   +---+-----------+----------+---+-------------+
   | 2 | Sam       |      156 |   | =TYPE(B2)=1 |
   +---+-----------+----------+---+-------------+
   | 3 | Nancy     |   34a-12 |   |             |
   +---+-----------+----------+---+-------------+
   | 4 | Fred      |    10021 |   |             |
   +---+-----------+----------+---+-------------+
   | 5 | Carol     |    7b-15 |   |             |
   +---+-----------+----------+---+-------------+

To find all records that contain a text string in the "CODE" field of the database, you must enter the formula =TYPE(B2)=2 in cell E2 of the computed criteria. To define the criteria range, select cells E1:E2 and choose Set Criteria from the Data menu.

MORE INFORMATION

When creating a computed criteria, you must observe the following rules:

  1. The field name of the computed criteria must be different from any of the field names in the database. In the above example, E1 is left blank.
  2. You must use a relative reference to the first record in the field of the database you want to reference in the formula. For example, B2 is a relative reference to the first record in the "CODE" field in the formula =TYPE(B2)=1.

For more information on the TYPE function, see page 240 of the "Microsoft Excel Function Reference" version 3.0 manual. If you are using Excel 2.2, see page 88 of the "Microsoft Excel Functions and Macros" version 2.2 manual. Note: This information also applies to Microsoft Excel for Windows versions 2.1, 2.1c, and 3.0, and to Microsoft Excel for OS/2 versions 2.2, 2.21, and 3.0.


KBCategory: kbother

KBSubcategory:

Additional reference words: 2.10 2.10c 3.00


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