How to Daverage Function in Excel
Learn multiple Excel methods to daverage function with step-by-step examples and practical applications.
How to Daverage Function in Excel
Why This Task Matters in Excel
Modern workbooks often store thousands, sometimes millions, of records about sales, staff, inventory, or production. Decision-makers rarely need the overall average of every single record; they need the average of a subset that meets specific rules:
- What is the average invoice amount for customers in Europe this quarter?
- How much does the company spend on overtime for employees in the Marketing department?
- What is the average lead time for orders larger than 10 000 units?
The DAVERAGE function belongs to Excel’s “Database” family (DSUM, DMAX, DCOUNT, etc.). These functions solve a common business need: calculate aggregate statistics on a table only for rows that match multi-column criteria. While modern functions such as AVERAGEIFS or FILTER plus AVERAGE can achieve similar results, DAVERAGE still shines in several situations:
- Flexible criteria layout – criteria live in easily editable cells, so non-technical colleagues can change the rules without touching the formula.
- Expandable tables – when the data grows downwards or rightwards, DAVERAGE automatically adjusts.
- Complex logic – you can combine “AND” and “OR” across many columns simply by adding extra rows to the criteria range.
Industries from finance to logistics still rely on DAVERAGE inside long-lived workbooks where the function’s transparency outweighs the appeal of newer formulas.
Not knowing DAVERAGE forces analysts to use cumbersome helper columns or manual filtering, leading to version errors, inconsistent reporting, and wasted hours. Mastering it links directly to other core Excel skills—structured references, dynamic named ranges, data validation, and report automation—making your spreadsheets more robust and future-proof.
Best Excel Approach
The most effective way to “daverage” (derive an average from a filtered database) is to use the DAVERAGE function on a properly structured Excel Table or a classic range organised in columnar form with a single header row.
Syntax and logic:
=DAVERAGE(database, field, criteria)
database– the entire data block including headers, e.g. [A1:G5000].field– the column to average. It can be a number representing the column index in the database or a text string matching a header label.criteria– the separate criteria block, at minimum two rows tall: header(s) on the first row, condition(s) on the next.
Why this approach is best:
- Criteria are visible, editable, and can hold formulas themselves.
- You automatically get “AND” logic across columns in the same row and “OR” logic across multiple rows.
- The function recalculates instantly when either data or criteria change, supporting interactive dashboards.
When to prefer alternatives:
- If you need partial text matches with wildcard support across several columns, AVERAGEIFS can be simpler.
- If your licences include Excel 365, combining FILTER with AVERAGE makes spill-array dashboards cleaner.
- However, for workbooks shared with users on older versions, DAVERAGE maintains excellent backward compatibility.
Parameters and Inputs
To avoid mis-fires, ensure:
databaseis a contiguous block with one header row only. Blank header cells break the function.- All data under each header should be of consistent type (numbers in numeric columns, dates in date columns). Mixed types create #DIV/0! when no rows match the numeric filter.
fieldaccepts either an integer (1 for the first column, 2 for the second…) or the exact header text typed inside double quotes. Using the header text keeps formulas readable:"Amount"not 7.criteriamust replicate identical header names as those indatabase. Extra spaces or mismatched capitalisation make Excel treat them as different fields.- Criteria cells can include:
– Relational operators such as
>1000or<=31-Dec-2024
– Wildcards*and?for text patterns
– Formulas that return a value (e.g.=TODAY()-30to average the last 30 days)
Validation rules:
- Do not put more than one condition in the same data cell; stack criteria vertically for OR logic or horizontally for AND logic.
- If the average would normally divide by zero (no rows meet the rules), DAVERAGE returns
#DIV/0!. Wrap it in IFERROR for a friendlier output.
Edge cases:
- Hidden rows are still considered; to respect manual filters instead, use SUBTOTAL with the AVERAGE function.
- If you convert the range to an Excel Table, you must reference the Table headers exactly in the criteria range.
Step-by-Step Examples
Example 1: Basic Scenario
Imagine a simple sales ledger:
| A | B | C | D |
|---|---|---|---|
| Date | Region | Sales Rep | Revenue |
| 01-Jan-2024 | North | Alice | 18 500 |
| 03-Jan-2024 | South | Bob | 12 300 |
| 04-Jan-2024 | North | Carla | 9 700 |
| 06-Jan-2024 | West | Alice | 14 200 |
| 07-Jan-2024 | North | Bob | 21 000 |
Goal: average revenue for the North region.
- Place your criteria block a few rows below:
F1: Region
F2: North
- Enter the DAVERAGE formula:
=DAVERAGE([A1:D6],"Revenue",[F1:F2])
Result: 16 400 (the mean of 18 500, 9 700, and 21 000).
Why it works:
- The header “Region” in [F1] matches the “Region” header in the database.
- Criteria in [F2] filters rows to North only.
- The function then averages the “Revenue” field for those rows.
Common variations:
- Change [F2] to
=E2where [E2] holds a dropdown of region names. DAVERAGE becomes an interactive lookup. - Add another criteria header in [G1] “Sales Rep” with “Alice” in [G2] to average North region sales by Alice only.
Troubleshooting:
- If you type “Revenue ” with a trailing space in [F1], the function returns #DIV/0! because the header no longer matches. Trim spaces or use the column index
4instead.
Example 2: Real-World Application
Scenario: An HR department tracks overtime:
| A | B | C | D | E |
|---|---|---|---|---|
| Employee | Department | Week Ending | Hours | Cost |
| Johnson | Marketing | 05-Jan-2024 | 6 | 210 |
| Lee | IT | 05-Jan-2024 | 8 | 280 |
| Ahmed | Marketing | 12-Jan-2024 | 7 | 245 |
| Wan | Finance | 12-Jan-2024 | 4 | 140 |
| Nelson | Marketing | 19-Jan-2024 | 9 | 315 |
| Lee | IT | 19-Jan-2024 | 6 | 210 |
Goal: average overtime hours for Marketing employees in January only.
- Criteria setup (cells H1:I2):
H1: Department I1: Week Ending
H2: Marketing I2: >=01-Jan-2024
I3: <=31-Jan-2024
Since date criteria are two separate conditions, we need two rows combining Department with each Week Ending rule:
H2: Marketing I2: >=01-Jan-2024
H3: Marketing I3: <=31-Jan-2024
This structure achieves “Department is Marketing AND Week Ending on or after 1 Jan 2024 AND Week Ending on or before 31 Jan 2024”.
- Formula:
=DAVERAGE([A1:E7],"Hours",[H1:I3])
Result: 7.33 hours.
Business impact:
- HR instantly sees typical overtime exposure within a specific month for one department, informing staffing decisions.
- Users can copy the criteria block to a dashboard sheet and hook it to slicers or data validation lists for self-service analytics.
Integration tips:
- Convert the data range to an Excel Table named
tblOvertime. The formula then becomes=DAVERAGE(tblOvertime,"Hours",[H1:I3]), automatically expanding when HR logs new weeks. - Add conditional formatting to the Hours column to flag records greater than 10 for quick visual scanning.
Performance considerations: On 50 000-row tables, DAVERAGE remains fast because it leverages Excel’s native calculation engine. Make sure Volatile functions such as TODAY inside criteria do not force constant recalculation on shared network drives.
Example 3: Advanced Technique
Complex scenario: Average cycle time for orders that meet either of two sets of rules:
- Orders from Region “East” with Order Quantity greater than 5 000
- Orders from Channel “Online” with Priority “High”
Data headers: Date, Region, Channel, Priority, Quantity, CycleTime.
Criteria block layout to achieve mixed OR logic:
| K | L | M | N |
|---|---|---|---|
| Region | Quantity | Channel | Priority |
| East | >5000 | ||
| Online | High |
- The first criteria row says: Region = East AND Quantity greater than 5 000.
- The second criteria row says: Channel = Online AND Priority = High.
- DAVERAGE combines these rows with OR, producing the union of the two result sets.
Formula:
=DAVERAGE([A1:F10000],"CycleTime",[K1:N3])
Professional tips:
- Because greater than and less than signs inside cells can be mis-keyed, lock them with data validation or define them through formulas (
=">"&G2). - If the criteria range is dynamic (users might add more OR rows), convert [K1:N3] to a table called
tblCriteriaand reference it in the formula. DAVERAGE automatically stretches to include new rows.
Performance optimisation:
- Use structured references so Excel only recalculates CycleTime when the dependent columns change.
- Cache volatile criteria values (NOW, RAND) into helper cells updated by macros, reducing recalculation hits in very large workbooks.
Error handling: Wrap the function to avoid ugly error messages on dashboards:
=IFERROR(DAVERAGE([A1:F10000],"CycleTime",[K1:N100]),"No matching records")
Tips and Best Practices
- Keep headers identical – copy the header row of your database directly into the criteria block to avoid typos.
- Isolate criteria on a dedicated sheet – prevents accidental deletion and keeps dashboards tidy.
- Name your ranges –
rngDBandrngCritmake formulas self-documenting and flexible. - Use data validation dropdowns for criteria cells so end-users select allowed values only, reducing errors.
- Add IFERROR wrappers to handle the inevitable “no match” scenarios gracefully.
- Document complex criteria with on-sheet comments or a legend so future maintainers grasp the logic quickly.
Common Mistakes to Avoid
- Mismatched headers – even a hidden space causes DAVERAGE to treat the column as non-existent, returning #DIV/0!. Always copy-paste headers.
- Blank criteria row – a completely blank row inside the criteria range acts as a wildcard “match everything”, often bloating the average unintentionally. Delete unused blank rows.
- Mixed data types – numbers stored as text in the field column lead to partial matches and skewed averages. Apply “General” or “Number” format consistently.
- Putting two operators in one cell – writing
>100 less than 500in a single criteria cell does not create a between operator; instead, split into two rows or two columns as demonstrated earlier. - Overlapping ranges – never place the criteria block inside the database area; Excel may include those criteria rows in the database leading to circular references.
Alternative Methods
Different paths to the same goal:
| Method | Pros | Cons | Best For |
|---|---|---|---|
| DAVERAGE | Visible criteria, OR logic easy, backward compatible to Excel 97 | Criteria must live on sheet, limited to “AND within row/OR across rows” pattern | Shared files, legacy workbooks |
| AVERAGEIFS | Simple syntax inside one cell, no separate criteria block | Harder to edit criteria, only supports AND logic unless you sum multiple formulas | Quick one-off calculations |
| FILTER + AVERAGE | Dynamic arrays, spill ranges visible, easy chaining with other functions | Excel 365 only, performance dips on massive data, formula becomes long | Interactive dashboards, Power BI-style layouts |
| PivotTable | Point-and-click, Drag fields to calculate averages, no formulas | Manual refresh, criteria flexibility limited to filters/slicers | Non-technical users, summary reports |
| Power Query | Handles millions of rows, refreshes from databases, merges data | Requires query editor knowledge, cannot recalc instantly | ETL pipelines, very large datasets |
Migration tips:
- To replace legacy DAVERAGE with AVERAGEIFS, replicate each criteria row as a separate AVERAGEIFS and wrap them in AVERAGE for OR logic.
- To modernise a workbook, load the data into Power Query, filter in the UI, and output the result to a pivot table.
FAQ
When should I use this approach?
Use DAVERAGE when you need editable, on-sheet criteria that multiple people can adjust without touching the formula itself, especially when OR logic is required between different rule sets.
Can this work across multiple sheets?
Yes. Place the database on Sheet1, criteria on Sheet2, and put the formula on Sheet3:
=DAVERAGE(Sheet1!A1:G1000,"Amount",Sheet2!A1:C3)
Just ensure that Sheet2 remains visible or protected; Excel must still read the criteria cells.
What are the limitations?
DAVERAGE cannot natively handle wildcard OR logic within the same criteria cell, and it always includes hidden rows. For visual filters that should be respected, switch to SUBTOTAL or AGGREGATE.
How do I handle errors?
Wrap DAVERAGE in IFERROR or IFNA:
=IFERROR(DAVERAGE(rngDB,"Revenue",rngCrit),0)
You can also test first with DCOUNT to see if any rows match before calculating the average.
Does this work in older Excel versions?
Absolutely. DAVERAGE has existed since Excel 5.0. The only caveat is that structured Table references are unavailable prior to Excel 2007; fall back to traditional [A1] style ranges.
What about performance with large datasets?
DAVERAGE is non-volatile and calculates quickly, but recalculation load is linear to database size. Use Excel Tables so the function only includes necessary rows, or filter source data with Power Query first to shorten the range.
Conclusion
Learning DAVERAGE equips you with a flexible, transparent way to calculate conditional averages without complex nested formulas. It bridges the gap between simple functions like AVERAGEIFS and heavy tools such as Power Query, making your workbooks powerful yet maintainable. Practise the techniques above, experiment with dynamic criteria, and combine DAVERAGE with data validation or dashboards. As you master it, you will speed up reporting cycles, reduce errors, and deepen your overall Excel proficiency—setting the stage for advanced analytics and automation down the road.
Related Articles
How to Show the 10 Most Common Text Values in Excel
Learn multiple Excel methods to list the 10 most frequent text values—complete with step-by-step examples, business use cases, and expert tips.
How to Abbreviate Names Or Words in Excel
Learn multiple Excel methods to abbreviate names or words with step-by-step examples and practical applications.
How to Abbreviate State Names in Excel
Learn multiple Excel methods to abbreviate state names with step-by-step examples, professional tips, and real-world applications.