|
|
The Excel DCOUNT Function
Excel Database Functions
The Excel Database Functions are included to assist you when working with an Excel database. This typically takes the form of a large table of data, where each row in the table stores an individual record. Each column in the spreadsheet table stores a different field (or type of information) for each record. The database functions perform basic operations, such as count, max, min, etc, but they enable the user to specify criteria, so that the operation is performed on selected records only. Other records in the database are ignored. Basic DescriptionThe Excel Dcount function returns the number of cells containing numbers, in a field (column) of a database for selected records only. The records to be included in the count are those that satisfy a set of one or more user-specified criteria. The function is very similar to the Excel Countifs function, which is new to Excel 2007. The syntax of the Excel Dcount function is :
DCOUNT( database, [field], criteria )
where the arguments are:
Wildcards
You can also use the following wildcards in text-related criteria:
? - matches any single character
* - matches any sequence of characters if you do actually want to find the ? or * character, type the ~ symbol before this character in your search. eg. the condition "A*e" will match all cells containing a text string beginning with "A" and ending in "e". The criteria supplied beneath each field heading can be either:
Note that the Excel database functions are not case sensitive. So, for example, the criteria ="Male" will be satisfied by cells containing the text "Male" or "male". Excel Dcount Function Examples
The following examples are based on the simple database on the right, which stores the examination marks scored by four children in three different subjects. Example 1The example below uses the Dcount function to count the number of Science examination scores recorded for male students. The criteria are specified in cells G1 - H2 and the Dcount formula is shown in cell G3:
The above Dcount function finds that there are 2 rows for which the Gender is "Male" and the Subject is "Science". However, only one of these rows (row 13) contains a number in the "Score" column. Therefore, the function returns the value 1 Note that, in the above example, the Dcount function has excluded cell E7 from the count, because this cell contains text, and not a number. (However, this cell would have been counted if the Dcounta function had been used instead of the Dcount function). Example 2In the example below, the Dcount function is used to find the number of Math examination scores recorded for females.
The above Dcount function finds two rows in which the Subject is "Math" and the Gender is "Female". However, as cell E8 is blank, the functions only counts cell E2. Therefore the functions returns the value 1 Note that, in the above two examples, instead of typing in "Score" for the Field argument, we could have simply used the number 5 (to denote the 5th column of the database). Example 3In the example below, the Dcount function is used to find the number of English examination scores that are higher than 60%. In this case, the Field argument is omitted, so the Dcount function simply counts all rows satisfying the supplied criteria:
The above Dcount function finds three rows for which the Subject is "English" and the Score is greater than 60%. The function therefore returns the count 3 Further examples of the Excel Dcount function can be found on the Microsoft Office website. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
Copyright © 2008-2011 ExcelFunctions.net |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||