Page 638 - Excel 2013 All-in-One For Dummies
P. 638
620 Using the Database Functions Using the Database Functions
Excel includes a number of database functions that you can use to calculate statistics, such as the total, average, maximum, minimum, and count in a particular field of the data list only when the criteria that you specify are met. For example, you could use the DSUM function in the sample Employee data list to compute the sum of all the salaries for employees who were hired after January 1, 2000, or you could use the DCOUNT function to compute the number of records in the data list for the Human Resources department.
The database functions, regardless of the difference in names (and they all begin with the letter D) and the computations that they perform, all take the same three arguments as illustrated by the DAVERAGE function:
DAVERAGE(database,field,criteria)
The arguments for the database functions require the following information:
✦ database is the argument that specifies the range containing the list and it must include the row of field names in the top row.
✦ field is the argument that specifies the field whose values are to be cal- culated by the database function (averaged in the case of the DAVERAGE function). You can specify this argument by enclosing the name of the field in double quotes (as in “Salary” or “Date Hired”), or you can do this by entering the number of the column in the data list (counting from left to right with the first field counted as 1).
✦ criteria is the argument that specifies the address of the range that con- tains the criteria that you’re using to determine which values are calcu- lated. This range must include at least one field name that indicates the field whose values are to be evaluated and one cell with the values or expression to be used in the evaluation.
Note that in specifying the field argument, you must refer to a column in the data list that contains numeric or date data for all the database functions with the exception of DGET. All the rest of the database functions can’t per- form computations on text fields. If you mistakenly specify a column with text entries as the field argument for these database functions, Excel returns an error value or 0 as the result. Table 2-2 lists the various database functions available in Excel along with an explanation of what each one calculates. (You already know what arguments each one takes.)