The VLOOKUP function in Google Sheets is a powerful tool for searching data within a spreadsheet. It allows users to efficiently find information in one column and return related data from another column within the same row, making data analysis and organization much simpler.
Syntax
VLOOKUP(search_key, range, index, [is_sorted])
- search_key: The value you want to search for in the first column of the range.
- range: The range of cells to search through. The first column in this range is where the function looks for the search_key.
- index: The column number in the range from which to return the matching value. The first column is 1, the second column is 2, and so on.
- is_sorted: An optional parameter that indicates whether the first column is sorted. Use TRUE for approximate matches or FALSE for exact matches.
Example #1
=VLOOKUP("Apple", A2:B5, 2, FALSE)
This function searches for “Apple” in the first column of the range A2:B5 and returns the corresponding value from the second column. Result: If A2 is “Apple” and B2 is “Red”, the result will be “Red.”
Example #2
=VLOOKUP(101, D2:E10, 2, TRUE)
This example looks for the key 101 in the first column of the range D2:E10 and returns the value from the second column. Result: If D5 has 101 and E5 reads “Device1”, it will return “Device1.”
Example #3
=VLOOKUP("John", F1:H10, 3, FALSE)
This function seeks out “John” in the first column of the specified range F1:H10 and retrieves the associated value from the third column. Result: If John is in F3 and H3 shows “Sales”, the output will be “Sales.”
Error handling
- N/A: This error occurs when the search_key is not found in the first column of the range.
- REF!: This error happens when the index is greater than the number of columns in the range provided.
- VALUE!: This indicates that the search_key is not of a recognizable data type, such as text instead of a number when searching for a number.