- Database Basics
- How the Functions Work
- Criteria Range
- Numeric Criteria
- Which Database Functions Are Available?
- Summary
How the Functions Work
The database functions perform common calculations such as sum, average, and count. They are designed specifically for use with databases, and their power lies in the fact that they let you specify which records to include in the calculation. If we return to the book database example, the database functions let you calculate things such as the following:
- The total value of all books by Patrick O’Brian
- The number of books by William Shakespeare
- The highest value of any book in the collection published since 1950
All the database functions are named using the format DXXX() where XXX is the name of the corresponding nondatabase Excel function. They all take the same three arguments. Let’s use DSUM() as an example:
DSUM(database, field, criteria)
- Database specifies the range containing the database, including the field names in the first row.
- Field is the name of the database field that the calculation will use.
- Criteria is the range containing the criteria that tell the function which records to use in the calculation.
The first two arguments are easy to figure out. Using the database in Figure 1 again, the database range is A1:F8, so that would be the first argument to the function; the field to be summed is named Value, so that’s the second argument. So far, we have the following:
=DSUM(A1:F8, "Value"..... )
It’s the third argument, criteria, that gives a lot of people trouble. Let’s take a look.