DSUM function

DSUM sums values in a database column that meet specified criteria—use it to total filtered column values from a data table.

=DSUM(database, field, criteria)

Generate a DSUM formula

Describe what you need. The generator will reach for DSUM where DSUM is the right tool, and tell you when it is not.

How to get a better answer
  • Name your columns by letter and by header: "column F (Net Value)" beats "the amount column".
  • State every condition, including the negatives — "not cancelled" changes the formula's shape.
  • Say where the data starts if it is not row 1, and whether it will grow.
  • Check the settings above match your spreadsheet: the wrong argument separator is a syntax error on your machine.

Arguments

How DSUM reads its arguments
databaserequiredfieldrequiredcriteriarequiredDSUM
ArgumentRequiredDescription
databaseRequiredThe data range including headers, typically a structured table with rows and columns. If the range is deleted or moved, DSUM returns #REF! error.
fieldRequiredThe column to sum, specified as a column name in quotes (text) or by column number starting at 1. Invalid or missing column names raise #VALUE! error.
criteriaRequiredA range containing headers and condition values that filter which rows are summed; multiple criteria columns apply AND logic. An empty criteria range matches all rows.

Returns

Returns a number representing the sum of values in the specified field where all criteria are satisfied.

Availability

Excel: All · Google Sheets: Supported

Worked examples

1. Sum inventory from a specific supplier

IngredientSupplierUnitQtyExpiry Date
Olive OilMediterranean CoL122027-01-15
GarlicFresh Farmskg52024-10-05
Tomato SauceRed Kitchencan242025-06-20
BasilFresh Farmsbundle82024-09-25
MozzarellaDairy Pluskg32024-09-20
ParmesanDairy Pluskg22027-03-10
FlourGolden Grainkg152025-12-01
SaltGolden Grainkg12027-06-30
=DSUM(A1:E8,"Qty",A10:B11)

Result: 13

The formula sums all Qty values where Supplier equals 'Fresh Farms'. Two rows match: Garlic contributes 5 units and Basil contributes 8 units, totaling 13 items from that supplier.

2. Sum inventory of items with shelf life remaining

IngredientSupplierUnitQtyExpiry Date
Olive OilMediterranean CoL122027-01-15
GarlicFresh Farmskg52024-10-05
Tomato SauceRed Kitchencan242025-06-20
BasilFresh Farmsbundle82024-09-25
MozzarellaDairy Pluskg32024-09-20
ParmesanDairy Pluskg22027-03-10
FlourGolden Grainkg152025-12-01
SaltGolden Grainkg12027-06-30
=DSUM(A1:E8,"Qty",E10:E11)

Result: 54

The criteria specifies Expiry Date > 2025-01-01, matching long-shelf-life items. Matching rows sum to 54: Olive Oil (12) + Tomato Sauce (24) + Parmesan (2) + Flour (15) + Salt (1).

3. Find total kilograms of ingredients in stock

IngredientSupplierUnitQtyExpiry Date
Olive OilMediterranean CoL122027-01-15
GarlicFresh Farmskg52024-10-05
Tomato SauceRed Kitchencan242025-06-20
BasilFresh Farmsbundle82024-09-25
MozzarellaDairy Pluskg32024-09-20
ParmesanDairy Pluskg22027-03-10
FlourGolden Grainkg152025-12-01
SaltGolden Grainkg12027-06-30
=DSUM(A1:E8,"Qty",C10:C11)

Result: 23

The formula sums Qty where Unit equals 'kg', selecting only weight-based entries. Four rows match: Garlic (5) + Parmesan (2) + Flour (15) + Salt (1) = 23 kilograms total.

Common errors

Which DSUM error are you seeing?
DSUM returned an error#NAME?
Correct the spelling to =DSUM(...) exactly, with matching parentheses. Verify the function is available in your spreadsheet application.
#VALUE!
Specify field as a text column name in quotes like "Qty" or as a column number like 4. Verify the column name exists in the database header row.
#REF!
Restore the deleted ranges or update the formula references to valid ranges. Ensure both database and criteria ranges still exist and contain data.
ErrorWhy it happensHow to fix it
#NAME?The function name is misspelled or DSUM is not recognized by the spreadsheet application, often typed as DSMU, DSUM, or another variant.Correct the spelling to =DSUM(...) exactly, with matching parentheses. Verify the function is available in your spreadsheet application.
#VALUE!The field argument is invalid—either the column name doesn't exist in the database, or the field is an array or expression instead of a single column reference.Specify field as a text column name in quotes like "Qty" or as a column number like 4. Verify the column name exists in the database header row.
#REF!The database or criteria range has been deleted, moved, or corrupted, breaking the cell references the formula depends on.Restore the deleted ranges or update the formula references to valid ranges. Ensure both database and criteria ranges still exist and contain data.

Tips and when to use something else

  • DSUM sums only numeric fields. To count matching entries instead, use DCOUNT; to retrieve a single matching value, use DGET.
  • Criteria comparisons are case-insensitive for text values; 'Fresh Farms' and 'fresh farms' match identically.
  • Specify field as a column name string ("Qty") or column number (4), starting from 1; both approaches are equally valid.
  • Build complex criteria by adding columns to your criteria range—each column adds an AND condition, so all criteria must be true for a row to match.

Frequently asked questions

Can DSUM sum multiple columns at once?
No. DSUM sums only one field per formula call. To sum multiple columns, create separate DSUM formulas and add them together with the plus operator.
What does DSUM return if no rows match the criteria?
DSUM returns 0, not an error. A zero result simply means no records in the database satisfied all the criteria conditions.
How do I set up DSUM with multiple criteria?
Create a criteria range with multiple columns, each labeled with a header from your database. Add condition values below the headers; all conditions must be true for a row to include its value in the sum.
When is DSUM better than SUMIF?
Use DSUM for multi-column criteria or when data is already structured as a formal table. SUMIF is simpler for single-condition sums on one column but lacks DSUM's multi-criteria power.

Need a different formula?

The full generator is not scoped to one function — describe any spreadsheet problem and it will pick.

Open the formula generator

Reviewed 2026-09-17