Database
DSUM Function in Excel
Adds the numbers in a field of records in a database that match criteria.
Syntax
- =DSUM(database, field, criteria)
Arguments
- database (required): The range containing the database
- field (required): Column to sum (name or number)
- criteria (required): Range containing the criteria
Examples
- =DSUM(A1:E100, "Sales", G1:H2) - Sum sales matching criteria - Result: $50,000
- =DSUM(A1:E100, 3, G1:G2) - Sum column 3 matching criteria - Result: 1500
D-functions vs DSUM
- Database functions use a criteria range with headers matching your list.
- For simple AND criteria [SUMIFS](/functions/sumifs/) may be easier to audit.
- Compare [SUMIF vs SUMIFS](/compare/sumif-vs-sumifs/) for reporting patterns.
Common errors
- #VALUE! if field doesn't exist
- Criteria headers must match database headers exactly
Use cases
- Database queries
- Filtered totals
- Complex criteria sums
Frequently asked questions
- What is the DSUM function in Excel? DSUM adds values in a database column that match specified criteria. The syntax is =DSUM(database, field, criteria). Unlike SUMIF, DSUM uses a separate criteria range with headers, allowing complex AND/OR conditions. It's part of Excel's database functions (D-functions) designed for structured data analysis.
- How do I set up criteria for DSUM? Create a criteria range with headers matching your database headers exactly. Put conditions below the headers. Same row = AND logic, different rows = OR logic. Example: Headers in G1:H1 ("Region", "Sales"), criteria in G2:H2 ("East", ">1000") finds East region sales over 1000. The criteria range must include headers.
- What is the difference between DSUM and SUMIFS? DSUM uses a criteria range (separate cells with headers), while SUMIFS uses inline criteria. DSUM is better for: complex OR conditions, reusable criteria, and database-style queries. SUMIFS is simpler for basic AND conditions. Example: SUMIFS(C:C, A:A, "East", B:B, ">1000") vs DSUM(A:C, "Sales", G1:H2) with criteria in G1:H2.
- How do I use OR conditions with DSUM? Put OR conditions on separate rows in your criteria range. Example: To sum sales for East OR West regions, put "East" in G2 and "West" in G3 (both under the "Region" header). DSUM will sum records matching either condition. This is easier than SUMIFS, which requires adding multiple SUMIF results for OR logic.
- Why is DSUM returning wrong results or errors? Common DSUM issues: 1) Criteria headers don't exactly match database headers (check spelling, spaces); 2) Criteria range includes empty rows (creates match-all condition); 3) Field name is misspelled or doesn't exist; 4) Database range doesn't include headers. Always verify your criteria range has the exact same headers as your database.
Editorial review
- Reviewed by Excel.Directory Editorial Team. Updated May 2026.