18.11.2014 Views

Microsoft Office

Create successful ePaper yourself

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

Part II<br />

Working with Formulas and Functions<br />

FIGURE 15.14<br />

The formula in cell B2 returns the address in the Data range for the value in cell B1.<br />

The formula in cell B2, which follows, returns the address of the cell in the Data range that contains the<br />

Target value:<br />

=ADDRESS(ROW(Data)+MATCH(Target,Data,0)-1,COLUMN(Data))<br />

If the Data range occupies a single row, use this formula to return the address of the Target value:<br />

=ADDRESS(ROW(Data),COLUMN(Data)+MATCH(Target,Data,0)-1)<br />

If the Data range contains more than one instance of the Target value, the address of the first occurrence is<br />

returned. If the Target value isn’t found in the Data range, the formula returns #N/A.<br />

Looking up a value by using the closest match<br />

The VLOOKUP and HLOOKUP functions are useful in the following situations:<br />

n<br />

n<br />

You need to identify an exact match for a target value. Use FALSE as the function’s fourth argument.<br />

You need to locate an approximate match. If the function’s fourth argument is TRUE or omitted<br />

and an exact match is not found, the next largest value less than the lookup value is returned.<br />

But what if you need to look up a value based on the closest match? Neither VLOOKUP nor HLOOKUP can<br />

do the job.<br />

Figure 15.15 shows a worksheet with student names in column A and values in column B. Range B2:B20<br />

is named Data. Cell E2, named Target, contains a value to search for in the Data range. Cell E3, named<br />

ColOffset, contains a value that represents the column offset from the Data range.<br />

288

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

Saved successfully!

Ooh no, something went wrong!