Excel **DSUM** function is a **DATABASE** sum function. The **DSUM** function calculates the sum of specified fields following specified criteria. It takes three mandatory arguments: **Range**, **Field**, and **Criteria**.

In this article, youâ€™ll get to learn how you can use the **DSUM** function with appropriate examples.

**Table of Contents**hide

**Download Excel Workbook**

**Excel DSUM Function: Syntax and Arguments**

**â¦˝ Function Objective: **

**Â **The **DSUM** function calculates the total sum of a specific **Field** by matching specific **Criteria** from a given **Range**.

**â¦˝ Syntax:**

`Â DSUM (database, field, criteria)`

**Â ****â¦˝ Arguments Explanation:**

Argument | Required/Optional | Explanation |
---|---|---|

Â Â Â Â Â Â Â range |
Required | Â Â Â Â Â range of cells that hold all the entries |

Â Â Â Â Â Â Â field |
Required | Â Â Indicates the column to be calculated for sum |

Â Â Â Â Â Â criteria |
Required | range of cells where specific conditions are assigned |

**Â ****â¦˝ What Can be Used as Criteria:**

**Â ****DSUM **offers multiple criteria types to filter data from the range. Some most used criteria types are

Criteria | Â Â Â Â Â Â Type |
Â Â Â Â Â Â Â Â Â Â Â Â Output |
---|---|---|

Â Â Â Â Â â€śUnit Priceâ€ť | Â Â Â Â Â Â String | Â Â Â Â Â Â Â Rows match â€śUnit Priceâ€ťÂ |

Â Â Â Â Â Â Â Cook* | Â Â Â Â Â Wildcard | Â Â Â Â Â Â Â Rows start with â€śCookâ€ť |

Â Â Â Â Â Â Â *ies | Â Â Â Â Â Wildcard | Â Â Â Â Â Â Â Â Rows end with â€śiesâ€ť |

Â Â Â Â Â Â Â Â 120 | Â Â Â Â Â Number | Â Â Â Â Â Â Â Â Â Â Equal to 120 |

Â Â Â Â Â Â Â >120 | Â Â Â Â Comparison | Â Â Â Â Â Â Â Â Â Greater than 120 |

Â Â Â Â Â Â Â <120 | Â Â Â Â Comparison | Â Â Â Â Â Â Â Â Â Â Less than 120 |

Â Â Â Â Â Â >=120 | Â Â Â Â Comparison | Â Â Â Â Â Greater than or equal 120 |

Â Â Â Â Â Â <>120 | Â Â Â Â Comparison | Â Â Â Â Â Â Â Â Â Not equal 120 |

Â Â Â Â Â Â Â Â <> | Â Â Â Â Comparison | Â Â Â Â Â Â Â Â Â Â Â Not blank |

Â Â Â Â Â Â Â =B7 | Â Â Â Â Formula | Â Â Â Â Â Equal to the argument of B7 |

**Â ****â¦˝ Return Parameter:**

**Â **The **DSUM** function returns a sum value.

**Â ****â¦˝ Applies To:**

**Â **Microsoft Excel version **2000** to Office** 365, **Excel version** 2011 **for** Mac **and onwards.

**4 Suitable Examples to Use the Excel DSUM Function **

**Example 1: DSUM Used as a Function**

Like all other functions, **DSUM** is an Excel function, and it works as such. You just have to declare the arguments as instructed by the syntax.

**âž§** Paste the following formula in any blank cell (i.e., **G5:H5**) to calculate the sum of the **Unit Price** field.

`=DSUM(B8:H19,"Unit Price",B5:C6)`

Inside the formula,

**B8:H19; **is the range.

**â€śUnit Priceâ€ť; **is the specified field of which you calculate the sum.

**B5:C6; **range where specific criteria exist.

**âž§ **Press **ENTER**. Then the evaluated value will appear.

By the formula, we impose two criteria

âŹ© Sum **Unit Price** of **Order ID**s greater than **10021**.

âŹ© Sum **Unit Price** of** Quantity** sold greater than or equal **120**.

The **DSUM** function evaluates **$3.74**. It sums the favorable entries (i.e. **$1.87** and **$1.87**) and results in (**$1.87+$1.87**) **$3.74**.

You can use different criteria depending on your data types and the **DSUM** function works just fine.

**Example 2: DSUM Calculates Total Sum (Single Criterion)**

Similar to the **SUM** function, the **DSUM** function can calculate the total sum of any Field (i.e., **Any Column**). In this case, we calculate the **Total Price** of every sold product from the dataset.

**âž§ **Write the below formula in any cell (i.e., **G5:H5**).

`=DSUM(B8:H19,"Total Price",B5:C6)`

In the formula,

**B8:H19; **indicates the range.

**â€śTotal Priceâ€ť; **indicates the specified field of which you calculate the sum.

**B5:C6; **refers to the range where specific criteria exist.

**âž§ **Hit **ENTER**. Afterward, the total sum value will appear.

The formula imposes only one criterion

âŹ© To sum the **Total Price** of **Order ID**s equal to or less than **10017** that means all the entries in the dataset.

The resultant value of the formula is **$2033.01. **It sums all the entries in the **Total Price** column**. **You can use other headers as fields to come up with the total sum.

**Example 3: DSUM Calculates Sum (Multiple Criteria)**

From the prior example (i.e., **Example 2**), we learn the **DSUM** function works similarly to the **SUM** function. But what if we just want to sum a specific field that complies with multiple conditions?

In this scenario, we impose four criteria in a range (i.e., **B5:E6**) and **DSUM** sums entries of **Total Price** field which have

âŹ© **Order ID** equal or greater than **10017.**

âŹ© Region **East.**

âŹ© Positioned in **Cookies** category.

âŹ© Identified as **Arrow Root** Product.

**âž§ **Write the following formula in any cell (i.e., **G5:H5**).

`=DSUM(B8:H19,"Total Price",B5:E6)`

The references declare the same arguments as they do in previous examples. All the criteria sit in the **B8:H19** range as we can see.

The formula matches every specified field to criteria and moves rightward to finally match appropriate entries.

**âž§ **Press **ENTER. **The aggregate value appears.

The formula finally matches **3 **entries that comply with the imposed conditions and returns a value of **$695.42**.

If we cross-check the resultant value with matched entries, the value appears to be the same (**$318.28**+**$303.02**+**$74.12**) **$695.42**.

**Example 4: DSUM Used in VBA Macros**

We can also use the **DSUM** function in **VBA Macro** codes. Following the Macro **DSUM** function format, we can mimic any previous examples of this article.

Letâ€™s say, we want the sum of the **Total Price** of every entry in the dataset.

**âž§ **Hit **ALT+F11** altogether. In a moment **Microsoft Visual Basic** Window opens up. In the **Microsoft Visual Window**, Select **Insert** > Choose **Module**.

**âž§ **In the **Module**, Paste the following Maco code then Hit **F5** to run the code.

```
Sub ExcelDSUMFunction()
Range("F5:G5").Value = Application.WorksheetFunction.DSum(Range("B8:H19"), "Total Price", Range("B5:C6"))
End Sub
```

In the **Macro** code,

**â€śF5:G5â€ť**; indicates where the resultant value will sit.

**âž§ **Back to the worksheet and youâ€™ll see the sum of **Total Price** entries in cell **F5:G5**.

**Differentiate SUMIF, SUMIFS and DSUM:**

Aspects | SUMIF | SUMIFS | DSUM |
---|---|---|---|

Â Â Syntax |
SUMIF(range, criteria, [sum_range])Â | Â Â Â Â SUMIFS(sum_range,Â Â Â Â Â Â Â Â Â Â Â criteria_range1, criteria1, [criteria_range2, criteria2], â€¦) | Â
Â Â Â DSUM(database, field, criteria) Â |

Â Database |
Conditional Function | Â Â Â Â Conditional Function | Â Â Â Â Â Â Â A database Function |

Â Formation |
No Particular Formation is Needed | No Particular Formation is Needed | Requires Field Labels to Operate |

Imposing Criteria |
Single Criterion can be Inserted Inside or Outside the Formula | Multiple Criteria can be Inserted Inside or Outside the Formula and Look messy but Flexible. | Criteria are Defined Outside or Inside the Formula and Look Clean |

Handling Multiple Criteria in Same Position |
Â
Not Applicable |
Unable to Handle Multiple Criteria in Same Position | Â Â Â Â Â Â Â Â Handles with Ease |

Â Understanding |
Comparatively Easy to Understand than SUMIFS Function | Â Â Harder to Understand and Apply | Â Â Â Â Â Â Â Â Â Easily Understood |

Building Complex Criteria |
Custom Complex Criteria Building is Hard | Very East to Build Custom Complex Criteria | Hard to Build Custom Complex Criteria |

**â§ Things to Keep in Mind While Using DSUM**

đź”Ľ The criteria range can be anywhere in the worksheet. However, it is preferred not to place criteria range in positions like overlapping with the dataset, and below the dataset.

đź”Ľ If** DSUM** has to perform to the whole dataset, place a blank line below the header of the criteria range.

đź”Ľ Any range of criteria can be used if it consists of at least one column field and one condition.

**Conclusion**

I hope the above-described uses of the **DSUM** function intrigue you to use the function more efficiently. If you have further queries or feedback, please let me know in the comment section. You can check out my other articles on the **Exceldemy** website.