MicrosoftВ® Office ExcelВ® 2007: Data Analysis and Business Modeling (Bpg -- Other)

Overview

Joolas is a small makeup company. In a Microsoft Office Excel 2007 worksheet, they track each sales transaction. Often, they want to answer questions such as:

As you saw in Chapter 38, “Using PivotTables to Describe Data,” Microsoft PivotTables are a great tool for summarizing data. Often, however, a PivotTable gives us much more information than we need. Database statistical functions make it easy to answer any “reporting” question without having to create a PivotTable.

You are already familiar with functions such as SUM, AVERAGE, COUNT, MAX, and MIN. By prefixing a D (which stands for database) to these (and other functions), you create database statistical functions. But what does the DSUM function do, for example, that the SUM function can’t? Whereas the SUM function adds up every cell in a cell range, the DSUM function enables you to specify (by using criteria) a subset of rows to add together in a cell range. For example, suppose we have a sales database for a small makeup company that contains the following information about each sales transaction:

You can find this data in the file Makeupdb.xlsx, which is shown in Figure 39-1.

Figure 39-1: We’ll use this data to describe how to work with database statistical functions.

Using the DSUM function with appropriate criteria, we could, for example, add up the revenue generated only by transactions involving lip gloss sales in the East during 2004. Essentially, the criteria we set up flags those rows that we want to include in the total sum. Within these rows, the DSUM function acts like the ordinary SUM function.

The syntax of the DSUM function is:

DSUM(database,field,criteria)

Now let’s go on to some examples that illustrate the power and versatility of database statistical functions.

Категории