Exact Matches with DSUM

Dave has a list of sales figures for some items that have similar part numbers. He uses DSUM to analyze the number of units shipped, based on the part number. For example, he may have part numbers such as ABC01, ABC01A, ABC01M, IFA01 and IFM01. When Dave uses DSUM to match a part number such as ABC01A, it works great. However, if he wants to do an analysis of part number ABC01, DSUM includes in its sum not only ABC01, but also ABC01A and ABC01M. Dave wonders how he can get DSUM to return the correct totals for exact matches only on the part number.

When using DSUM, you need to be very careful with how you enter your criteria. For instance, let’s say you enter ABC01 in the criteria table. Do this, and you’ll get what you’ve noticed: DSUM matches all part numbers that begin with those five characters.

The solution is to enter your criteria in this manner:


Note the two equal signs in what you enter. The first one tells Excel to accept, as a literal, what follows in the quote marks. (It is, essentially, a formula you are entering.) When entered this way, the DSUM function matches only those part numbers that are exactly ABC01.

Interestingly, neither of the following works as a criteria:


Of course, if all you want to do is figure out how many units of a particular part number were shipped, you might consider using either the SUMIF or SUMIFS functions instead of DSUM. It only makes sense to use DSUM when you have multiple criteria you want to check in your analysis. The SUMIF and SUMIFS functions don’t have the same strict requirements on entering criteria.