13 VLOOKUP and HLOOKUP

VLOOKUP and HLOOKUP

The purpose of VLOOKUP (vertical lookup) is to match a value in the first column of a table and then place the corresponding answer in the cell.

The purpose of HLOOKUP (horizontal lookup) is to match a value in the first row of a table and then place the corresponding answer in the cell.

SYNTAX (How it is Written)

There are three arguments in the vlookup and hlookup function: the value to look up, the range of cells which contains the information in a table, and the column (or row) number of the table which contains the answer. The syntax of vlookup and hlookup follows:
=VLOOKUP(Cell containing value to lookup, range of cells, column)
=HLOOKUP(Cell containing value to lookup, range of cells, row)

Notes:

• Be sure table doesn’t have blank rows
• First column should have lookup values (VLOOKUP) or First row should have lookup values (HLOOKUP)
• The range of cells where the table resides (don’t include column headings or title of table)
• Table should be placed above or below the data
• Use VLookUp when records in table are organized in rows See VLOOKUP example below where the number and the corresponding letter grade are in
the same row.
• Use HLookUp when records in table are organized in columns (not typical for data in lists). See HLOOKUP example below where the number and the corresponding
letter grade are in the same column.

VLOOKUP
0 F
60 D
70 C
80 B
90 A

 

 

 

 

 

 

HLOOKUP
0 60 70 80 90
F D C B A

 

 

 

 

STEPS TO FOLLOW:

Show a list of student grades and a VLOOKUP table below the students grades

  1. Create a table of information for your VLOOKUP.
  2. This is an example for a VLOOKUP. The information is located in C10:D14
  3. Since we are looking for the letter grade based on the average test score, you need to set up the VLOOKUP function under grade (column F). Click in F4.
  4. The syntax of VLOOKUP is the following (shown in words):

=VLOOKUP(what you are looking up (which is the test average), where are you looking it up (which is the grade table), what column is the answer in (which is the second column))

 

So when you create the VLOOKUP in F4, the function will look like the following:

=VLOOKUP(E4,$C$10:$D$14,2,TRUE)

where E4 is what you are looking up in the first column of the table,

$C$10:$D$14 is the range of the table where the grade information is,

2 is the column where the answer is which is the letter grade,

TRUE allows you to find the closest match. This is important because students have averages like 97, 82 and 67. To find these, the range lookup is “TRUE”, keep in mind the default is “TRUE” if you do not add a range lookup value.

True is used when you want it to look for the closest match. For this instance, we want TRUE. None of the test averages are exactly the same as the number in the table. It will find the match between numbers. So Harry has 74 the VLOOKUP will return a C for him.

 

“FALSE” is used when it must match exactly. If you are looking up someone’s Student ID number, you want to find that students number exactly and not someone with a close number.

Media Attributions

  • LOOKUP example