Vlookup And Hlookup In Google Sheet in Google Sheets
The VLOOKUP and HLOOKUP functions in Google Sheets are used to search for a value in a specific row or column of a table, and then return a corresponding value from the same row or column. Here's an overview of each function:
1. VLOOKUP: This function is used to search for a value in the first column of a table and return a value from a specified column in the same row. The basic syntax is:
=VLOOKUP(search_key, range, index, [is_sorted])
The "search_key" argument is the value you want to search for in the first column of the table. The "range" argument is the range of cells that make up the table, including the first column and the column you want to return a value from. The "index" argument is the column number of the table that contains the value you want to return. The "is_sorted" argument is optional and specifies whether the data in the first column is sorted in ascending order.
2. HLOOKUP: This function is used to search for a value in the first row of a table and return a value from a specified row in the same column. The basic syntax is:
=HLOOKUP(search_key, range, index, [is_sorted])
The "search_key" argument is the value you want to search for in the first row of the table. The "range" argument is the range of cells that make up the table, including the first row and the row you want to return a value from. The "index" argument is the row number of the table that contains the value you want to return. The "is_sorted" argument is optional and specifies whether the data in the first row is sorted in ascending order.
Here's an example of how to use the VLOOKUP function in Google Sheets to search for a customer's name in a table and return their corresponding phone number:
=VLOOKUP(A2, B2:C10, 2, FALSE)
In this example, the formula searches for the value in cell A2 (the customer's name) in the first column of the table B2:C10, and then returns the corresponding value from the second column (the phone number). The "FALSE" argument tells the formula to only return an exact match.
And here's an example of how to use the HLOOKUP function in Google Sheets to search for a product code in a table and return its corresponding price:
=HLOOKUP(A2, A1:E4, 4, FALSE)
In this example, the formula searches for the value in cell A2 (the product code) in the first row of the table A1:E4, and then returns the corresponding value from the fourth row (the price). The "FALSE" argument tells the formula to only return an exact match.
No comments:
Post a Comment