Lookup Functions in Excel: An Overview of 5
Functions
(1)The LOOKUP Function
Let’s start by exploring the LOOKUP function in excel, exploring the syntax and parameters, the
vector form, and a worked example.
Syntax and parameters
=LOOKUP(lookup_value, lookup_vector, [result_vector])
Here are some explanations:
● lookup_value: The value to search for.
● lookup_vector: The single row or column to search.
● result_vector (optional): The range containing the value to return.
Using the vector form
The vector form is commonly used and requires both fields lookup_vector and result_vector to
be the same size.
Explanation with examples
=LOOKUP(90, A2:A10, B2:B10)
This function searches for the largest value less than or equal to 90 in A2:A10, then returns the
corresponding value from B2:B10.
In this case, only row 5 would match the parameters we have set. Therefore, the output of the
function would produce the “Medium-High” result.
Limitations of the LOOKUP function
Requirement for sorted data: The lookup_vector must be sorted in ascending order.
Approximate match behavior: Does not support exact matches—returns the closest value
less than or equal to lookup_value.
(2)The VLOOKUP Function
Next is the VLOOKUP function, which is one of the most commonly used functions in legacy
versions of Excel.
Syntax and parameters
VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])
● lookup_value: The value to search for in the first column of the table_array.
● table_array: The table range to search.
● col_index_num: The column number to return a value from.
● range_lookup: Optional; TRUE for approximate match, FALSE for exact.
How to use VLOOKUP: Step-by-step guide with examples
Now, let’s quickly go through how this function works using an example.
We’ll use the following function in a simple dataset.
=VLOOKUP("John", A2:C10, 3, FALSE)
This function will look for any entries that belong to John and output his salary amount.
Searches for "John" in column A and returns the value from the third column (column C) in the
same row.
As expected, the VLOOKUP function output is 6000, which matches row 4, which is the value
we were looking for, since it belongs to John.
Exact vs approximate matches
Exact matches are the most commonly used type of match in VLOOKUP. This means that the
function will only return a result if it finds an exact match for the lookup value in the first column
of the specified range.
For example, if we were to use an exact match when searching for John's salary, the VLOOKUP
function would only return a result if there was a row with "John" in the first column and his
salary in the second column.
On the other hand, approximate matches allow for some flexibility in finding values. This is
useful when working with numerical data or data that may have small variations (for example,
due to rounding or formatting).
To summarize:
● Exact (FALSE): Finds a precise match.
● Approximate (TRUE): Requires sorted data and finds the nearest match.
Common errors and troubleshooting
When working with VLOOKUP for the first time, some common errors may arise.
Handling #N/A errors
One of the most common errors when using VLOOKUP is #N/A, which stands for "Not
Available." This usually occurs when the value being searched for cannot be found in the
specified range.
This can also be caused by a missing lookup_value or unsorted data when using an
approximate match.
To troubleshoot this error, double-check that your search value is spelled correctly and exists in
the first column of the range you are searching in. Also, make sure that your data is sorted in
ascending order if using an approximate match.
Another potential issue is a mismatch between data types. For example, if one column contains
numbers represented as text and another column contains actual numbers, VLOOKUP may not
work properly.
Column index number issues
Another error that may occur is the #REF! Error. If col_index_num exceeds the number of
columns in table_array, a #REF! error occurs.
(3)The HLOOKUP Function
To search for a value in the top row of a table and return a value from a specified row in the
same column, the HLOOKUP function is often the best choice. Let’s see how it works.
Syntax and parameters
HLOOKUP(lookup_value, table_array, row_index_num, [range_lookup])
● lookup_value: The value to search for in the first row.
● table_array: The table to search.
● row_index_num: The row number to return a value from.
● range_lookup: TRUE (approximate) or FALSE (exact).
How to use HLOOKUP: Step-by-step guide with examples
=HLOOKUP("Q1", A1:D3, 2, FALSE)
The HLOOKUP function above searches for "Q1" in row 1 and returns the value from row 2 in
the same column.
Let’s run the function and see the results.
As you can see above, the function should return 1200. Since the function looks for the value
found in row 2 based on the value specified in row 1, 1200 is the right output we are looking for.
(4)The INDEX and MATCH Functions
Next, let’s see how the INDEX and MATCH functions in Excel combine to look up values.
Syntax and example usage
=INDEX(array, row_num, [column_num])
The INDEX function returns the value at a specific row and column in a given range.
=MATCH(lookup_value, lookup_array, [match_type])
The MATCH function returns the relative position of lookup_value in lookup_array.
Using INDEX and MATCH together
When both the INDEX and MATCH functions are used together, they provide a powerful
tool for looking up values in a table or range. This combination allows you to specify the
exact location of the value you want to return, rather than having to manually input the
row and column numbers.
Let’s look at an example:
=INDEX(B2:B10, MATCH("John", A2:A10, 0))
This combination finds the row where "John" appears in A2:A10, then returns the
corresponding value from B2:B10.
Let’s see what the function will output.
When the two functions are used together, they achieve the same result as using the
VLOOKUP function. However, using INDEX and MATCH allows for more flexibility in
choosing which column to return from, as well as being able to search in multiple
columns.
(5)The XLOOKUP Function (Excel 2019 and Later)
Finally, let’s look at one of the newest Excel lookup functions, XLOOKUP.
Syntax and parameters
XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found],
[match_mode], [search_mode])
Practical examples
We’ll be applying the function on a simple dataset and example.
=XLOOKUP("John", A2:A10, B2:B10, "Not Found")
The function above searches for "John" in A2:A10 and returns the value from B2:B10;
returns "Not Found" if missing.
Looking at the output from the formula given above, we can see that the “Not Found”
output was shown. This means that there is not such entry with the employee name of
“John”.
Comparison: LOOKUP vs. VLOOKUP vs. XLOOKUP
Let’s put all these functions together to see how they match up and look at their
differences.
Feature LOOKUP VLOOKUP XLOOKUP
Orientation Vertical Vertical Both
Exact Match No Yes Yes
Approx Match Yes Yes Yes
Left Lookup No No Yes
Requires Sorted Yes Yes (for approx) No
Data
Error Handling No Limited Yes
End Lookup Season here.. Radhey Radhey ✨