# How to Use DSUM Function with Multiple Criteria in Excel

An individual might need to sum up only the values that satisfy certain criteria from a large dataset. The DSUM function can be very useful if we want to add values based on multiple conditions or criteria in Excel. In this article, we will show you two examples of how to use the DSUM function with multiple criteria in Excel.

## 2 Suitable Examples to Use DSUM Function with Multiple Criteria in Excel

In this article, we will demonstrate two suitable examples of how to use the DSUM function with multiple criteria in Excel. Here’s an overview of the dataset for our today’s task. ### Example 1: Calculating Total Price Using DSUM Function with Multiple Criteria

In this example, we will calculate the total price of a product using the DSUM function with multiple criteria in Excel. We will walk you through the steps to do so.

Steps:

• First of all, create a table with all the imposed criteria you want.
• In this example, we want to calculate the Total Price for the following four criteria:
1. Employee: Zack
2. Date: > 31-05-2022
3. Product: Earbuds
4. Quantity Sold >= 50 • Then select cell F21 and write down the following formula.
`=DSUM(B4:F16,"Total Price",B20:E21)`
• After that, press  Enter , and you will have the total price for all imposed criteria. • Only rows 8 and 16 satisfy the four specified criteria in this example. If we sum up the total price of these two rows, we will get the exact result we got with the DSUM function. ### Example 2: Calculate Total Price of Specified Entries Using VBA

In this example, we will run a VBA code to calculate the total price of specified entries. Read the following steps to learn how to do it.

Steps:

• First, press  Alt + F11  to open the Microsoft Visual Basic window.
• Next, from the Insert tab, go to,

Insert → Module • Then copy the following code and paste it to the Module window.
``````Sub DSUM_VBA()
Range("F21").Value = Application.WorksheetFunction.DSum(Range("B4:F16"), "Total Price", Range("B20:E21"))
End Sub`````` • After that, press  F5  to run the code and go back to your worksheet.
• As a result, you will have the total price for the specified multiple criteria. Notes
• Don’t forget to give proper cell references, or you won’t get the desired result.
• Make sure that the specified criteria range does not overlap the table.

## Conclusion

Thanks for making it this far. I hope you find this article useful. Now you know two suitable examples of using the DSUM function with multiple criteria. Please let us know if you have any further queries, and feel free to give us any recommendations in the comment section below.

## Related Articles #### Alif Bin Hussain

Hello! Welcome to my Profile. Currently, I am working and doing research on Microsoft Excel and here I will be posting articles related to this. My last educational degree was BSc and my program was Civil Engineering from Bangladesh University of Engineering & Technology (BUET). I am a fresh graduate with a great interest in research and development. I do my best to acquire new information and try to find out the most efficient solutions.

We will be happy to hear your thoughts  5 Excel Tips
You Never Knew  