Statistical Analysis with Excel For Dummies. Joseph Schmuller. Читать онлайн. Newlib. NEWLIB.NET

Автор: Joseph Schmuller
Издательство: John Wiley & Sons Limited
Серия:
Жанр произведения: Программы
Год издания: 0
isbn: 9781119844563
Скачать книгу
selected range of cells to name, Excel looks for a nearby name — just above a column or just to the left of a row. If no name is present, you get to supply one in the New Name dialog box. (You can also open the New Name dialog box by choosing Formulas | Define Name.)FIGURE 2-14: The New Name dialog box. When you select a range of cells, like a column, with a name at the top, you can include the cell with the name in it and Excel attaches the name to the range. I strongly advise against doing this, however. Why? If I select C1 through C13, the name Revenue_Millions refers to cells C1 through C13, not C2 through C13. In that case, the first value in the range is text, and the others are numbers.For a formula such as SUM (or SUMIF or SUMIFS, which I discuss next), this doesn't make a difference: In those formulas, Excel just ignores values that aren’t numbers. If you have to use the whole array in a calculation, however, it makes a huge difference: Excel thinks the name is part of the array and tries to use it in the calculation. You see this in the next section, on creating your own array formulas.

      5 Click OK.Excel attaches the name to the range of cells.

      Using the named array, then, the formula is

       =SUM(Revenue_Millions)

      which is more descriptive than

       =SUM(C2:C13)

Snapshot of entering a formula directly into a cell opens these boxes.

      FIGURE 2-15: Entering a formula directly into a cell opens these boxes.

Snapshot of completing the formula.

      FIGURE 2-16: Completing the formula.

      A couple of other formulas show just how convenient this naming capability can be. These formulas, SUMIF and SUMIFS, add a set of numbers if specific conditions in one cell range (SUMIF) or in more than one cell range (SUMIFS) are met.

      To take full advantage of naming, I name my table's column A (Year) and column B (Region) in the same way I named column C.

      

When you define a name for a cell range like B2:B13 in this example, beware: Excel can be quirky when the cells hold names. It might guess that the name in the uppermost cell is the name you want to assign to the cell range. In this case, Excel guesses North for the name rather than Region. If that happens, you make the change in the New Name dialog box.

Snapshot of managing the Defined Names in a worksheet.

      FIGURE 2-17: Managing the Defined Names in a worksheet.

      Next, I sum the data in column C, but only for the North region. That is, I consider a cell in column C only if the corresponding cell in column B contains North. To do this, I follow these steps:

      1 Select a cell for the formula result.My selection here is C15.

      2 Choose Formulas | Math & Trig.

      3 From the pop-up menu that appears, choose SUMIF.This selection opens the Function Arguments dialog box, shown in Figure 2-18.SUMIF has three arguments. The first, Range, is the range of cells to evaluate for the condition to include in the sum (North, South, East, or West, in this example). The second, Criteria, is the specific value in the range (North, for this example). The third, Sum:range, holds the values I sum.FIGURE 2-18: The Function Arguments dialog box for SUMIF.

      4 In the Function Arguments dialog box, enter the appropriate values for the arguments.Here's where another Defined Names button comes in handy. In that Ribbon area, click the down arrow next to Use in Formula to open the drop-down list shown in Figure 2-19.Choosing from this list fills in the Function Arguments dialog box, as shown in Figure 2-20. I had to type North into the Criteria box. Excel adds the double quotes.

      5 Click OK.The result appears in the selected cell. In this example, it’s 78.

Snapshot of the Use in Formula drop-down list.

      FIGURE 2-19: The Use in Formula drop-down list.

      In the Formula bar, this line appears:

       =SUMIF(Region,"North", Revenue_Millions)

      

If you choose to, you can type the line exactly that way into the Formula bar, without using the dialog box or the drop-down list. When you don't use the dialog box, you have to supply the double quotes around the criteria.

Snapshot of completing the Function Arguments dialog box for SUMIF.

      FIGURE 2-20: Completing the Function Arguments dialog box for SUMIF.

       = SUMIF(B2:B13,"North", C2:C13)

      isn’t it?

      Incidentally, the same cell range can be both the Range and the Sum:range. For example, to sum just the cells for which Revenue_Millions is less than 25, you’d use

       =SUMIF(Revenue_Millions, "< 25", Revenue_Millions)

      

The second argument (Criteria) is always in double quotes.

      What about SUMIFS? That one is useful if you want to find the sum of revenues for North but only for the years 2006 and 2007. Follow these steps to use SUMIFS to find this sum:

      1 Select a cell for the formula result.The selected cell is C17.

      2 Choose Formulas | Math & Trig.

      3 From the pop-up menu that appears, choose SUMIFS.This step opens the Function Arguments dialog box.

      4 In the Function Arguments dialog box, enter the appropriate values for the arguments, as shown in Figure 2-21.Notice that, in SUMIFS, the Sum Range argument appears first. In SUMIF, however, it appears last.Note that the formula in the Formula bar is now=SUMIFS(Revenue_Millions,Year,"<2008",Region,"North")FIGURE 2-21: The completed