D sum
DSUM Function¶
The DSUM function sums the values in a column of a database (a labeled range) for rows that match a criteria range. It's the database-style counterpart to SUMIF / SUMIFS, with criteria specified as a separate labeled range rather than inline.
Syntax:¶
DSUM(database, field, criteria)
- database: The range of cells that makes up the list or database. The first row must contain column labels (headers).
- field: The column to sum. Either the 1-based column number, or the header label as text (case-insensitive).
- criteria: A range that contains the conditions. Its first row holds header labels matching one or more
databaseheaders; subsequent rows hold the filter values. Cells in the same row AND together; multiple rows OR together.
Examples:¶
=DSUM(A1:E11, "Salary", G1:G2)whereG1:G2isDept/Eng— sums salaries of all rows whose Dept equals "Eng".=DSUM(A1:E11, 3, G1:G2)— same as above, using the column index3instead of the header label"Salary".=DSUM(A1:E11, "Salary", G1:H2)whereG1:H2isDept/Salaryheaders andEng/>=100— sums salaries where Dept="Eng" AND Salary≥100.
Usage Notes:¶
- Returns 0 when no rows match the criteria (matches Excel behavior).
- Comparison operators in criteria values:
>,>=,<,<=,<>,=(or no prefix for equality). - Wildcards
*(any sequence) and?(single character) are supported in equality criteria. - Non-numeric cells in the field column are ignored.
- String comparisons are case-insensitive.