18.11.2014 Views

Microsoft Office

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Part II<br />

Working with Formulas and Functions<br />

The following array formula returns the contents of the last nonempty cell in the first 500 rows of column A:<br />

{=INDEX(A1:A500,MAX(ROW(A1:A500)*(A1:A500””)))}<br />

You can, of course, modify the formula to work with a column other than column A. To use a different column,<br />

change the four column references from A to whatever column you need. If the last nonempty cell<br />

occurs in a row beyond row 500, you need to change the two instances of 500 to a larger number. The<br />

fewer rows referenced in the formula, the faster the calculation speed.<br />

You can[‘t use this formula, as written, in the same column with which it’s working.<br />

Attempting to do so generates a circular reference. You can, however, modify it. For example,<br />

to use the function in cell A1, change the references so that they begin with row 2 instead of row 1.<br />

CAUTION<br />

Returning the last value in a row<br />

The following array formula is similar to the previous formula, but it returns the last nonempty cell in a row<br />

(in this case, row 1):<br />

{=INDEX(1:1,MAX(COLUMN(1:1)*(1:1””)))}<br />

To use this formula for a different row, change the 1:1 reference to correspond to the row.<br />

Ranking data with an array formula<br />

Often, computing the rank orders for the values in a range of data is helpful. If you have a worksheet containing<br />

the annual sales figures for 20 salespeople, for example, you may want to know how each person<br />

ranks, from highest to lowest.<br />

If you’ve used the Excel program’s RANK function, you may have noticed that the ranks produced by this<br />

function don’t handle ties the way that you may like. For example, if two values are tied for third place, the<br />

RANK function gives both of them a rank of 3. You may prefer a commonly-used approach that assigns each<br />

an average (or midpoint) of the ranks — in other words, a rank of 3.5 for both values tied for third place.<br />

Figure 18.8 shows a worksheet that uses two methods to rank a column of values (named Sales). The first<br />

method (column C) uses the Excel RANK function. Column D uses array formulas to compute the ranks.<br />

The following is the array formula in cell D5:<br />

{=SUM(1*(B5

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

Saved successfully!

Ooh no, something went wrong!