Using Lookup and Reference Functions
You
can use lookup and reference functions in Excel to easily retrieve
information from a data list. The lookup functions (VLOOKUP and HLOOKUP)
allow you to search for and insert a value in a cell that is stored in
another place in the worksheet. The HLOOKUP function looks in rows (a
horizontal lookup) and the VLOOKUP function looks in columns (a vertical
lookup). Each function uses four arguments (pieces of data) as shown in
the following definition: =VLOOKUP (lookup_value, table_array,
col_index_num, range_lookup). The VLOOKUP function finds a value in the
left-most column of a named range and returns the value from the
specified cell to the right of the cell with the found value, while the
HLOOKUP function does the same to rows. In the example,
=VLOOKUP(12,Salary,2,TRUE), the function looks for the value 12 in the
named range Salary and finds the closest (next lower) value, and returns
the value in column 2 of the same row and places the value in the
active cell. In the example, =HLOOKUP (“Years”,Salary,4,FALSE), the
function looks for the value “Years” in the named range Salary and finds
the exact text string value, and then returns the value in row 4 of the
column.
Use the VLOOKUP Function
- Create a data range in which the left-most column contains a unique value in each row.
- Click the cell where you want to place the function.
- Type =VLOOKUP(value, named range, column, TRUE or FALSE), and then press Enter.
- Or click the Formulas tab, click the Look & Reference button, click VLOOKUP, specify the function arguments, and then click OK.
Use the HLOOKUP Function
- Create a data range in which the uppermost row contains a unique value in each row.
- Click the cell where you want to place the function.
- Type =HLOOKUP(value, named range, row, TRUE or FALSE), and then press Enter.
- Or click the Formulas tab, click the Look & Reference button, click HLOOKUP, specify the function arguments, and then click OK.
Argument | Description |
---|
lookup_value | The
value found in the row or the column of the named range. You can use a
value, cell reference or a text string (enclosed in quotation marks). | table_array | The named range of information in which Excel looks up data. | col_index_num | The
numeric position of the column in the named range (counting from the
left) for the value to be returned (use only for VLOOKUP). | row_index_num | The numeric position of the row in the named range (counting from the top) for the value to be returned (use only for HLOOKUP). | range_lookup | The
value returned when the function is to find the nearest value (TRUE) or
an exact match (FALSE) for the lookup_value. The default value is TRUE. |
Using Text Functions
You
can use text functions to help you work with text in a workbook. If you
need to count the number of characters in a cell or the number of
occurrences of a specific text string in a cell, you can use the LEN and
SUBSTITUTE functions. If you want to narrow the count to only upper or
lower case text, you can use the UPPER and LOWER functions. If you need
to capitalize a list of names or titles, you can use the PROPER
function. The function capitalizes the first letter in a text string and
converts all other letters to lowercase.
Use Text Functions
- Create a data range in which the left-most column contains a unique value in each row.
- Click the cell where you want to place the function.
- Type = (equal sign), type a text function, specify the argument for the selected function, and then press Enter.
Some examples include:
- =LEFT(A4,FIND(“ ”,A4)-1)
- =RIGHT(A4,LEN(A4-FIND(“*”,SUBSTITUTE(A4,” “,”*”,LEN(A4)- LEN(SUBSTITUTE(A4,” “,””)))))
- =UPPER(A4)
- =LOWER(A4)
- =PROPER(A4)
Or click the Formulas tab, click the Text button, click a function, specify the function arguments, and then click OK.
You can use wildcard characters in a criteria.
A question mark (?) matches any single character. An asterisk (*)
matches any sequence of characters. If you want to find an actual
question mark or asterisk, type a tilde (~) before the character.
|