0Pricing
Excel Formulas Academy · Lesson

Summing Records With DSUM

Total a field for rows that match your criteria range.

Summing Records With DSUM is a free Excel Formulas Academy lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Excel Formulas Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

What DSUM Does

DSUM adds up the numbers in one column of a table, but only for the rows that match a criteria range. Think of it as a SUMIFS that reads its conditions from a block of cells instead of from inside the formula.

It shines when you have many conditions or want users to change the filters by editing cells rather than rewriting formulas.

The DSUM Syntax

The pattern is:

DSUM(database, field, criteria)

  • database - the full table including headers, e.g. A1:C13.
  • field - the column to total, given as a header name in quotes like "Amount" or as a column number.
  • criteria - the criteria range you built earlier.
=DSUM(A1:C13, "Amount", E1:E2)

A First Total

Imagine sales data in A1:C13 with headers Region, Rep, Amount. In E1 put Region and in E2 put East.

The formula below totals the Amount column for every East row. If East rows are 1200, 800, and 500, the result is 2500. Change E2 to West and the total instantly recalculates - no formula edit needed.

=DSUM(A1:C13, "Amount", E1:E2)

Choosing the Field

The field argument decides which column gets summed. Two ways to write it:

  • By name: "Amount" - clear and resistant to column reordering.
  • By position: 3 - the third column of the database range.

Using the header name is usually safer because inserting a column will not break it. Just keep the spelling identical to the table header.

=DSUM(A1:C13, 3, E1:E2)

Summing With a Number Condition

You can total based on a numeric rule. Put Amount in E1 and >1000 in E2. Now DSUM adds only the amounts above 1000.

This is handy for questions like 'what is the total of all large orders?' The comparison lives in a cell, so a manager can adjust the threshold without touching the formula.

=DSUM(A1:C13, "Amount", E1:E2)

Two Conditions With AND

To total East orders over 1000, build a two-column criteria range. Put headers Region and Amount in E1:F1, then East and >1000 in E2:F2.

Because both conditions sit on the same row, they are joined with AND. DSUM sums Amount only for rows that are East and above 1000.

=DSUM(A1:C13, "Amount", E1:F2)

Two Values With OR

To total both East and West, stack the values on separate rows. Put Region in E1, East in E2, and West in E3.

Separate rows mean OR, so DSUM adds the Amount for any row that is East or West. Remember to extend the criteria argument to E1:E3 so it covers both condition rows.

=DSUM(A1:C13, "Amount", E1:E3)

DSUM vs SUMIFS

Both can sum with conditions, but they differ:

  • SUMIFS keeps criteria inside the formula - great for one-off totals.
  • DSUM reads criteria from cells - great for dashboards where users tweak filters, or for complex AND/OR logic that SUMIFS handles awkwardly.

If you find yourself nesting many SUMIFS for OR logic, DSUM with a multi-row criteria range is often cleaner.

=SUMIFS(C2:C13, A2:A13, "East", C2:C13, ">1000")

Watch the Database Range

The database argument must include the header row. If you pass only the data rows (A2:C13) without headers, DSUM cannot map the field name to a column and returns an error.

Also keep the range tight around your real data. Including stray blank rows below is fine for sums but can confuse other D-functions, so it is a good habit either way.

=DSUM(A1:C13, "Amount", E1:E2)

Handling No Matches

If no rows match the criteria, DSUM simply returns 0 - it does not throw an error. That is usually fine, but a zero can look like a real total.

Pair it with DCOUNT to know whether any records actually matched, or wrap the result with a check so a zero from no matches reads differently from a zero total.

=IF(DCOUNT(A1:C13,"Amount",E1:E2)=0, "No records", DSUM(A1:C13,"Amount",E1:E2))

Live Dashboard Totals

The real payoff of DSUM is interactivity. Place a dropdown in the criteria value cell E2 listing each region, then point DSUM at E1:E2.

Now a single cell drives the total: pick East and the figure shows East sales; pick North and it flips to North. You can stack several DSUM cells - one per metric - all reading the same dropdown, turning a flat table into a responsive summary panel with zero formula edits.

=DSUM(A1:C13, "Amount", E1:E2)

Quick Check

You wrote =DSUM(A1:C13, "Amount", E1:E2) with Region in E1 and East in E2. What does it return?

Recap

DSUM totals one column for rows matching a criteria range:

  • Syntax: DSUM(database, field, criteria).
  • Include the header row in the database argument.
  • The field can be a quoted header name or a column number.
  • Same-row criteria = AND; separate-row criteria = OR.
  • No matches returns 0, not an error.

Next we count matching records with DCOUNT.

Frequently asked questions

Is the “Summing Records With DSUM” lesson free?

Yes — the full text of “Summing Records With DSUM” is free to read here on the web, and the Excel Formulas Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Excel Formulas Academy course, upgrade to CoddyKit PRO.

What will I learn in “Summing Records With DSUM”?

Total a field for rows that match your criteria range. You practise Excel Formulas Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Excel Formulas Academy?

No prior experience is required. Excel Formulas Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Summing Records With DSUM” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Excel Formulas Academy lesson?

Yes. Every Excel Formulas Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Setting Up a Criteria Range
  2. Summing Records With DSUM
  3. Counting Records With DCOUNT
  4. Averaging and Extracting With DAVERAGE and DGET
← Back to Excel Formulas Academy