Excel LOOKUP function with formula examples - computerskagyan

 lookup function excel


The LOOKUP function in Excel searches for a value in a range or an array and returns a corresponding value from another range or array. The function is useful when you need to find a specific value in a list or table and retrieve a related value from the same or another column.

The syntax for the LOOKUP function is:

Lookup, vlookup, hlookup, index, match, function in excel


Here, lookup_value is the value you want to find, lookup_array is the range or array in which you want to search for the lookup value, and [result_array] is the optional range or array from which you want to return a corresponding value.

The function works in two different ways, depending on whether the lookup_array is sorted or not. If the lookup_array is sorted in ascending order, LOOKUP finds the largest value that is less than or equal to the lookup_value. If the lookup_array is sorted in descending order, LOOKUP finds the smallest value that is greater than or equal to the lookup_value. If the lookup_array is not sorted, LOOKUP finds an exact match for the lookup_value.

If a corresponding value is found, the function returns that value. If not, the function returns #N/A.

Here is an example of how to use the vector form of the LOOKUP function:

Suppose you have a table of grades for a class of students, and you want to find the grade for a specific student based on their name. You can use the LOOKUP function to search for the student's name in a column of names, and return the corresponding grade from a column of grades.
  1. Start by creating a table with the names of the students in column A and their grades in column B.
  2. In a new cell, enter the formula "=LOOKUP("John", A1:A5, B1:B5)" (without the quotes). This formula will search for the name "John" in the range A1:A5, and return the corresponding grade from the range B1:B5.
  3. Press enter, and the grade for John will be displayed in the cell.
If the name "John" is not found in the range A1:A5, the LOOKUP function will return the last value in the range B1:B5. To avoid this, you can use the VLOOKUP function instead, which searches for the value in the leftmost column of a table and returns a value in the same row from a specified column.

Note: The array form of the LOOKUP function is not recommended for use, as it can produce unexpected results. Instead, use the INDEX and MATCH functions together to perform array lookups in Excel.

VLOOKUP Function

VLOOKUP is a function in Excel that stands for Vertical Lookup. It is used to search for a value in the first column of a table or range, and then return a corresponding value from a specified column in the same row. 

Lookup, vlookup, hlookup, index, match, function in excel


Here is an example of how to use the VLOOKUP function:

Suppose you have a table that contains a list of employees, their IDs, and their salaries, and you want to find the salary of a specific employee based on their ID.

1. Start by creating a table with the employee names in column A, their IDs in column B, and their salaries in column C.
2. In a new cell, enter the formula "=VLOOKUP("ID123", B1:C5, 2, FALSE)" (without the quotes). This formula will search for the ID "ID123" in the range B1:B5, and return the corresponding salary from the range C1:C5.
3. Press enter, and the salary for the employee with ID123 will be displayed in the cell.

The VLOOKUP function takes four arguments:

  • Lookup_value: The value you want to search for in the first column of the table.
  • Table_array: The table or range containing the data you want to search through.
  • Col_index_num: The column number in the table or range from which you want to return the corresponding value.
  • Range_lookup: This is an optional argument that determines whether you want an exact match or an approximate match. In most cases, you should set this to FALSE to ensure an exact match.
One important thing to note when using the VLOOKUP function is that the lookup value must be in the first column of the table or range you are searching through. If it is not, you can use the INDEX and MATCH functions together to perform a lookup based on a value in a different column.

HLOOKUP Function

HLOOKUP is a function in Excel that stands for Horizontal Lookup. It is similar to the VLOOKUP function, but instead of searching for a value in the first column of a table or range, it searches for a value in the first row and returns a corresponding value from a specified row.

Lookup, vlookup, hlookup, index, match, function in excel


Here is an example of how to use the HLOOKUP function:

Suppose you have a table that contains a list of products, their IDs, and their prices for different regions, and you want to find the price of a specific product in a specific region.

1. Start by creating a table with the product names in row 1, their IDs in row 2, and their prices for different regions in rows 3 and 4.
2. In a new cell, enter the formula "=HLOOKUP("Product1", A1:D4, 3, FALSE)" (without the quotes). This formula will search for the product name "Product1" in the first row of the range A1:D4, and return the corresponding price for the specified region from the row below it.
3. Press enter, and the price for Product1 in the specified region will be displayed in the cell.

The HLOOKUP function takes four arguments:
  • Lookup_value: The value you want to search for in the first row of the table.
  • Table_array: The table or range containing the data you want to search through.
  • Row_index_num: The row number in the table or range from which you want to return the corresponding value.
  • Range_lookup: This is an optional argument that determines whether you want an exact match or an approximate match. In most cases, you should set this to FALSE to ensure an exact match.
One important thing to note when using the HLOOKUP function is that the lookup value must be in the first row of the table or range you are searching through. If it is not, you can use the INDEX and MATCH functions together to perform a lookup based on a value in a different row.

Index and Match Function

In Excel, the LOOKUP function can be used to search for a value in a range or array and return a corresponding value from another range or array. However, the LOOKUP function is not as flexible as other lookup functions, such as VLOOKUP or INDEX and MATCH. In this case, the INDEX function can be combined with the MATCH function to create a more powerful lookup formula.

The basic syntax for combining INDEX and MATCH functions to create a lookup formula is as follows:

Lookup, vlookup, hlookup, index, match, function in excel


  • return_range: The range of cells that contains the values you want to return.
  • lookup_value: The value you want to search for.
  • lookup_range: The range of cells that contains the values you want to search.
  • match_type: Optional. Specifies whether you want an exact match or an approximate match.
Here is an example of how to use INDEX and MATCH to create a lookup formula:

Suppose you have a table of data that contains employee names in column A, employee IDs in column B, and salaries in column C. You want to be able to look up an employee's salary based on their ID number. To do this, you can use INDEX and MATCH to find the row containing the employee's salary, and then use the INDEX function to return the salary from column C.

Start by creating a table with the employee names in column A, employee IDs in column B, and salaries in column C.
In a new cell, enter the formula =INDEX(C1:C10, MATCH(12345, B1:B10, 0)). This formula will search for the value "12345" in column B of the range B1:B10, and return the corresponding salary from column C.
Press enter, and the salary for the employee with ID number 12345 will be displayed in the cell.
In this example, the MATCH function is used to find the row number containing the ID number "12345" within the range B1:B10. The resulting row number is then used in the INDEX function to retrieve the salary from column C.

Using INDEX and MATCH to create a lookup formula allows you to perform more flexible and powerful lookups in Excel. You can use this method to look up values based on a variety of criteria, such as names, dates, and other identifying information.

If you read brief explanations of vlookup, hlookup, index and match function at a click below links.

Vlookup

Hlookup



Comments