Search This Blog

pCloud Crypto

The DSUM formula with example in Excel

The DSUM function in Excel is used to calculate the sum of values in a specified field (column) of a database that meet certain criteria. It's part of Excel's database functions which operate on a range treated as a database.

Syntax

excel
DSUM(database, field, criteria)
  • database: The range of cells that makes up the database. The first row should contain the column headers.
  • field: Indicates which column to use in the function. This can be a column label enclosed in double quotation marks (e.g., "Age") or a number that represents the column's position in the list (e.g., 2 for the second column).
  • criteria: The range of cells that contains the conditions you specify.

Example

Let's consider an example to understand how the DSUM function works.

Example Database

Suppose you have the following data in cells A1:D6:

NameAgeGenderSalary
John28Male50000
Alice34Female65000
Bob45Male45000
Carol28Female55000
Dave34Male60000

Criteria

You want to sum the salaries of all males. Place the criteria in cells F1:G2:

Gender
Male

DSUM Formula

  1. In cell H1, enter the formula:
    excel
    =DSUM(A1:D6, "Salary", F1:F2)
    This will output 155000.

Here's the step-by-step explanation:

  • database: A1:D6 (the entire range of the database including headers).
  • field: "Salary" (the column from which to sum the values).
  • criteria: F1:F2 (the range where the criteria is specified).

The DSUM function looks at the "Salary" column and sums the values where the "Gender" is "Male".

Another Example with Multiple Criteria

Suppose you want to sum the salaries of males aged 34. You can add more criteria like this in cells F1:G3:

GenderAge
Male34
  1. In cell H2, enter the formula:
    excel
    =DSUM(A1:D6, "Salary", F1:G3)
    This will output 60000.

Here's the explanation for this second example:

  • database: A1:D6.
  • field: "Salary".
  • criteria: F1:G3 (the range where the criteria for "Gender" and "Age" are specified).

The DSUM function sums the "Salary" values where the "Gender" is "Male" and the "Age" is 34.

Summary

The DSUM function is powerful for summing values in a database that match specific criteria. It can handle multiple criteria across different columns, making it versatile for data analysis tasks.

No comments:

Post a Comment

pCloud Lifetime

Popular Posts