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.

Creating Formulas That Look Up Values 15<br />

the function uses the row in which the value you want to look up is greater than or equal to the row value<br />

but less than the value in the next row. In the case of a tax table, this is exactly what you want to happen.<br />

The HLOOKUP function<br />

The HLOOKUP function works just like the VLOOKUP function except that the lookup table is arranged horizontally<br />

instead of vertically. The HLOOKUP function looks up the value in the first row of the lookup table<br />

and returns the corresponding value in a specified table row.<br />

The syntax for the HLOOKUP function is<br />

HLOOKUP(lookup_value,table_array,row_index_num,range_lookup)<br />

The HLOOKUP function’s arguments are as follows<br />

n<br />

n<br />

n<br />

n<br />

lookup_value: The value to be looked up in the first row of the lookup table.<br />

table_array: The range that contains the lookup table.<br />

row_index_num: The row number within the table from which the matching value is returned.<br />

range_lookup: Optional. If TRUE or omitted, an approximate match is returned. (If an exact<br />

match is not found, the next largest value less than lookup_value is returned.) If FALSE, VLOOKUP<br />

will search for an exact match. If VLOOKUP can’t find an exact match, the function returns #N/A.<br />

TIP<br />

If the lookup_value argument is text, it can include wildcard characters * and ?.<br />

Figure 15.3 shows the tax rate example with a horizontal lookup table (in the range E1:J3). The formula in<br />

cell B3 is<br />

=HLOOKUP(B2,E1:J3,3)<br />

FIGURE 15.3<br />

Using HLOOKUP to look up a tax rate.<br />

The LOOKUP function<br />

The LOOKUP function has the following syntax:<br />

LOOKUP(lookup_value,lookup_vector,result_vector)<br />

The function’s arguments are as follows:<br />

n<br />

n<br />

n<br />

lookup_value: The value to be looked up in the lookup_vector.<br />

lookup_vector: A single-column or single-row range that contains the values to be looked up.<br />

These values must be in ascending order.<br />

result_vector: The single-column or single-row range that contains the values to be returned.<br />

It must be the same size as the lookup_vector.<br />

277

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

Saved successfully!

Ooh no, something went wrong!