This blog is brought to you by the Excel Community where you can find additional blogs, extended articles and webinar recordings on a variety of Excel related topics. In addition to live training events, Excel Community members have access to a full suite of online training modules from Filtered. There is also an online forum where you can ask questions and share ideas with other community members.
Hello all and welcome back to the Excel Tip of the Week! This week, we have a Creator level post in which we are looking again at the family of "database" functions in Excel, last covered in TOTW #154. This Tip builds directly on last week's Tip about Advanced Filter, so you might want to revise that, but as a quick reminder, Advanced Filter requires us to use a special layout to apply complex filters in Excel:
We're going to be building on the same example as last time - you can download the file from the bottom of this post.
What are database functions?
Essentially, the database functions are functions that work a lot like other common Excel functions, but with the added element that they can filter which data they work with using an Advanced Filter-like layout. This is like having access to a bunch more SUMIF-like functions - except database functions are actually a bit more flexible when it comes to either-or conditions, which are not supported by traditional functions like SUMIF that instead require all of their conditions be met.
Here is the full list of database functions, along with their regular-function equivalents:
As you can see, the functions are generally named with a D and then the name of a normal function.
All of these functions are written the same way, with the same three inputs:
Database is the range containing the database (table) in question - including headersField is the name of the particular field (column) that the function will be looking at - this can either be entered as text between quotation marks, or a cell reference to the field name.Criteria is a range with the criteria in it. As discussed in last week's Tip on Advanced Filter, this has to consist of column headings with conditions written underneath them.
Let's look at an example - a function that will find the value of the largest invoice approved by Haran:
We discussed earlier that we can make more flexible conditions with these functions than with traditional ones - let's look at an example of that.
When writing more complex conditions, the basic rule is that rules on the same row are additive (both must be satisfied), whereas rules on different rows are optional (either could be satisfied). You can create multiple conditions for the same column by duplicating the appropriate column heading.
So, here's a compound condition and formula for "what was the average value of a Riemann Brothers invoice approved by either Gauss or Euler?". Note that there is no DAVERAGE function, but we can use DSUM/DCOUNT to get to the same result.
Download the file from below and see what kinds of functions and conditions you can make!
Previous post - Revisiting Advanced FilterTOTW index Next post - Floating point errors