Excel DSUM Function
Categorized as a Database Function, the DSUM function calculates the sum of numbers from a database that match the given criteria.
The DSUM function returns the sum of values matching certain conditions in a database.
- The DSUM function, like all other database functions, is not case-sensitive.
- The field argument can be a column header by its name in quotation marks, the number that indicates the position of a specific column in the database, and the cell reference of a column header.
- The criteria argument can be any range of cells. But it must include at least one column label and at least one cell below the column label to specify the condition. Multi-row criteria are also accepted.
- A variety of expressions such as wildcards can be applied in the criteria argument. Here are some examples.
- The purpose of the criteria argument is to filter the database and specify which records should be calculated.
- The column headers in the criteria range must be included in the database range.
- In theory, the criteria range can be located anywhere on the worksheet . But it is recommended not to be placed under the data list, in case more data need to be added.
In this case, we need to calculate the sum of all sales in the database that match the criteria. See the screenshot:
To do so, please copy the formula below into cell F7 and press the Enter key to get the result.
=DSUM (B3:D11, 3, F3:H4)
- In the above formula, we use the number that indicates the position of the sales column in the database range as the field argument, which is 3 since the sales column is at the 3rd position.
- We can change the value in the field argument to the column header name enclosed in quotation marks. In this case, the input value becomes “sales” in the field argument. And the formula becomes:
=DSUM (B3:D11, "sales" , F3:H4)
- The field argument can also be entered as a cell reference, which is D3 in this case. So the formula changes to:
=DSUM (B3:D11, D3 , F3:H4)