Microsoft KB Archive/60911

{| = Excel: Select Records for Last 30 Days Criteria Example Wrong =
 * width="100%"|

Last reviewed: November 2, 1994

Article ID: Q60911

SUMMARY
The formula =&quot;>=NOW-30&quot; on page 170 of the &quot;Microsoft Excel Reference&quot; version 2.2 manual does not select all records for the last 30 days in a database.

To correctly perform this function, a computed criteria must be used, as in the following example (where B2 is a reference to the date field in the first record in the database):

=B2>=NOW-30 To set up the computed criteria, place this formula at the end of the criteria range. Do not include a fieldname as the heading for the computed criteria; either include a descriptive text string, or leave the cell above the formula blank. For example, if the criteria is located in cells G1:G2, enter the computed criteria in cell H2. Select cells G1:H2 and choose Set Criteria from the Data menu.

+---+--+---+  |   |    G     |       H       | +---+--+---+  | 1 |  Name    |               | +---+--+---+  | 2 |          | =B2>=NOW-30 | +---+--+---+ For more information on computed criteria, see pages 171-172 of the &quot;Microsoft Excel Reference&quot; version 2.2 manual.
 * }