How to use the VLOOKUP function to search for data in a table in Google Sheets?

To use the VLOOKUP function to search for data in a table in Google Sheets, follow these steps:

  1. Open Google Sheets and navigate to the sheet where you want to perform the search.

  2. Identify the table where you want to search. Ensure that the table has at least two columns, with the leftmost column containing the search key.

  3. Select an empty cell where you want the search result to appear.

  4. Type the formula "=VLOOKUP(search_key, table_range, index, [is_sorted])" in the selected cell. Replace the placeholders with the actual values:

    • "search_key" is the value you want to search for.
    • "table_range" is the range of cells that contain the table, including the leftmost column containing the search key.
    • "index" is the column number in the table from which you want to return the result. The leftmost column is 1, the next one is 2, and so on.
    • [Optional] "is_sorted" indicates whether the table is sorted in ascending order. Use "true" or "1" if sorted, or "false" or "0" if not sorted. If omitted, the function assumes the table is sorted.

    For example, if you want to search for the value "Apple" in the range A2:B10 and return the corresponding value from column B, the formula would be: "=VLOOKUP("Apple", A2:B10, 2, false)".

  5. Press Enter to execute the formula. The selected cell will display the result of the search.

Note: If the search key is not found in the table, the function will return an error. You can handle such cases by using the IFERROR function to display a custom message or an alternative value.