tech on the net

MS Excel: DSUM Function (WS)

In Microsoft Excel, the DSUM function sums the numbers in a column or database that meets a given criteria.

Syntax

The syntax for the DSUM function is:

DSUM( range, field, criteria )

range is the range of cells that you want to apply the criteria against.

field is the column to sum the values. You can either specify the numerical position of the column in the list or the column label in double quotation marks.

criteria is the range of cells that contains your criteria.

Applies To

Type of Function

Worksheet Function Example

Let's take a look at an example to see how you would use the DSUM function in a worksheet:

Microsoft Excel

Based on the Excel spreadsheet above, the DSUM function would return the following:

=DSUM(A4:D8, "Unit Cost", A1:B2) would return 7.99
=DSUM(A4:D8, 3, A1:B2) would return 7.99
=DSUM(A4:D8, "Quantity", A1:A2) would return 20
=DSUM(A4:D8, 2, A1:A2) would return 20

Using Named Ranges

You can also use a named range in the DSUM function. For example, we've created a named range called orders that refers to Sheet1!$A$4:$D$8.

Microsoft Excel

Then we've entered the following data in Excel:

Microsoft Excel

Based on the Excel spreadsheet above, the DSUM function would return the following:

=DSUM(orders, "Total Cost", A1:B2) would return 60.88
=DSUM(orders, 4, A1:B2) would return 60.88

To view named ranges: Under the Insert menu, select Name > Define.

Microsoft Excel