Setting Up a Criteria Range
Build the header-and-condition block that D-functions read.
Setting Up a Criteria Range is a free Excel Formulas Academy lesson on CoddyKit — lesson 1 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.
Meet the D-Functions
Excel has a family of database functions whose names all start with the letter D: DSUM, DCOUNT, DAVERAGE, DGET, and more.
They work on a table laid out like a tiny database: a row of column headers on top, with records below. Instead of typing conditions inside the formula, you point each D-function at a separate criteria range on the sheet that describes what to match.
This lesson is all about building that criteria range correctly, because every D-function depends on it.
The Three Arguments
Every D-function shares the same three arguments:
- database - the whole table including its header row.
- field - which column to operate on (a header name in quotes, or a column number).
- criteria - the range that holds your matching rules.
So the shape is always DSUM(database, field, criteria). The criteria argument is the part beginners get wrong, so we focus on it first.
=DSUM(A1:D20, "Amount", F1:F2)What a Criteria Range Looks Like
A criteria range is just a small block of cells with at least two rows:
- The top row holds column headers that match the database headers exactly.
- The rows below hold the conditions.
Imagine sales data with headers Region, Rep, Amount. To match only the East region, your criteria range is two cells stacked: Region on top, East below it.
Headers Must Match Exactly
The header in your criteria range must spell the database header identically. If your data column is named Amount but your criteria says Amounts or amt, the D-function will not find the column and may error or return zero.
The safest habit is to copy the header cell from the table and paste it into the criteria range. That guarantees an exact text match including any trailing spaces.
A Worked Example
Say A1:C13 holds your table with headers Region, Rep, Amount. In cell E1 type Region and in E2 type East. That two-cell block, E1:E2, is your criteria range.
Now DSUM totals only East rows. The function reads the header in E1, sees it matches the Region column, then keeps only rows where Region equals East.
=DSUM(A1:C13, "Amount", E1:E2)Text Criteria and Partial Matches
By default a text condition like East matches values that begin with that text. So East would also match Eastern.
To force an exact match, wrap it with a formula-style comparison: ="=East" typed into the criteria cell. You can also use wildcards: E* matches anything starting with E, and ?at matches Cat, Bat, or Hat.
="=East"Number and Comparison Criteria
Criteria are not limited to text. You can use comparison operators for numbers:
>1000matches amounts above 1000.<=50matches values 50 or less.<>0matches anything that is not zero.
Put the header (for example Amount) on top and the comparison text beneath it. The D-function evaluates each record's value against that rule.
Combining Conditions With AND
Conditions placed side by side on the same row are joined with AND - all must be true.
To match East region with Amount over 1000, build a two-column criteria range: headers Region and Amount on the top row, then East and >1000 on the row below. A record passes only if it is East and above 1000.
Combining Conditions With OR
Conditions placed on separate rows are joined with OR - any matching row qualifies.
To match East or West, put the header Region on top, then East in the next row and West in the row after. The criteria range now spans three rows, and a record passes if it matches either value.
Remember to include all those rows in the criteria argument.
=DSUM(A1:C13, "Amount", E1:E3)Mixing AND and OR
You can combine both layouts. Suppose you want (East AND >1000) OR (West AND >500).
Use two columns, Region and Amount. Put East with >1000 on one row, then West with >500 on the next row. Each row is an AND group; the separate rows act as OR. This grid layout is how D-functions express rich logic without nesting functions.
Common Criteria-Range Mistakes
Watch out for these traps:
- Forgetting the header row - a criteria range needs headers, not just conditions.
- Selecting a blank row inside the criteria range - an empty condition row matches every record, returning everything.
- Header typos that no longer match the table.
- Leaving the criteria block touching the data table so they overlap.
Keep the criteria range in its own clear area of the sheet.
Quick Check
In a D-function criteria range, how are two conditions written on the same row combined?
Recap
A criteria range is the heart of every D-function. Key points:
- It needs a header row whose names match the table exactly.
- Conditions go in the rows beneath - text, wildcards, or comparisons like
>1000. - Same row = AND, separate rows = OR.
- Avoid blank condition rows, which match everything.
With a clean criteria range ready, you can now feed it to DSUM, DCOUNT, DAVERAGE, and DGET in the lessons ahead.
Frequently asked questions
Is the “Setting Up a Criteria Range” lesson free?
Yes — the full text of “Setting Up a Criteria Range” 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 “Setting Up a Criteria Range”?
Build the header-and-condition block that D-functions read. 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 1 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Setting Up a Criteria Range” 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
- Setting Up a Criteria Range
- Summing Records With DSUM
- Counting Records With DCOUNT
- Averaging and Extracting With DAVERAGE and DGET