11.08.2013 Views

Excel's Formula - sisman

Excel's Formula - sisman

Excel's Formula - sisman

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 17: Charting Techniques 447<br />

Cell A1 contains the value 10. The value in this cell determines which rows to hide. Column B contains<br />

identical formulas that use the value in cell A1. For example, the formula in cell B4 is as follows:<br />

=MOD(ROW()–ROW($A$4),$A$1)<br />

This formula subtracts the current row number from the first data row number in the table, and<br />

uses the MOD function to calculate the remainder when that value is divided by the value in A1.<br />

As a result, every nth cell (beginning with row 4) contains 0. Use the filter drop-down list in cell<br />

B3 to specify a filter that shows only the rows that contain a 0 in column B.<br />

If you change the value in cell A1, you need to respecify the filter criteria for column B.<br />

(The rows will not hide automatically.)<br />

Although this example uses a table (created using Insert➜Tables➜Table), the technique also<br />

works with a normal range of data as long as it has column headers. Choose Data➜Sort &<br />

Filter➜Filter to enable filtering.<br />

Plotting the last n data points<br />

You can use a technique that makes your chart show only the most recent data points in a column.<br />

For example, you can create a chart that always displays the most recent six months of<br />

data (see Figure 17-11).<br />

The instructions that follow describe how to create the chart in this figure:<br />

1. Create a worksheet like the one shown in Figure 17-11, and create a chart that uses the<br />

data in A1: B26.<br />

2. Choose <strong>Formula</strong>s➜Defined Names➜Name Manager to bring up the Name Manager dialog<br />

box.<br />

3. Click New to display the New Name dialog box.<br />

4. In the Name field, type MonthRange. In the Refers To field, enter this formula:<br />

=OFFSET(Sheet1!$A$1,COUNTA(Sheet1!$A:$A)–6,0,6,1)<br />

Notice that the OFFSET function refers to cell A1 (not the cell with the first month).<br />

5. Click OK to close the New Name dialog box.<br />

6. Click New to define the second name.<br />

7. In the New Name dialog box, type SalesRange in the Names in Workbook field. Enter this<br />

formula in the Refers To field:<br />

=OFFSET(Sheet1!$B$1,COUNTA(Sheet1!$B:$B)–6,0,6,1)<br />

8. Click OK, and then click Close to close the Name Manager dialog box.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!