How to use VLOOKUP in Google Sheets
The VLOOKUP function is one of the most popular functions in Google Sheets, allowing you to look up and retrieve data from a table or range. Let's dive into how to use it, how to combine it with other functions, and some common errors to watch out for.
Syntax:
The VLOOKUP function has the following syntax:
VLOOKUP(lookup_value, table_array, col_index, [range_lookup])
lookup_value
: the value you want to look uptable_array
: the range of cells that contains the data you want to searchcol_index
: the column number that contains the value you want to return[range_lookup]
: [optional] a boolean value that specifies whether you want an exact match (FALSE) or an approximate match (TRUE)
Example:
Suppose you have a table with employee data, and you want to find the department of an employee with the ID "E1234".
Employee ID | Name | Department |
---|---|---|
E1234 | John Smith | Sales |
E5678 | Jane Doe | Marketing |
E9012 | Bob Johnson | IT |
You can use the VLOOKUP function like this:
=VLOOKUP("E1234", A2:C4, 3, FALSE)
This formula looks up the value "E1234" in the first column of the range A2:C4, and returns the value in the third column (Department).
Combining with other functions:
VLOOKUP can be combined with other functions to create more powerful formulas. For example:
- Using INDEX-MATCH instead of VLOOKUP:
=INDEX(C:C, MATCH("E1234", A:A, 0))
- Using VLOOKUP with IFERROR to handle errors:
=IFERROR(VLOOKUP("E1234", A2:C4, 3, FALSE), "Not found")
Common errors:
- #N/A: The value is not found in the table array.
- #VALUE!: The lookup value is not a valid value.
- #REF!: The table array is not a valid range.
To avoid these errors, make sure to:
- Check the spelling and formatting of the lookup value.
- Ensure the table array is a valid range.
- Use the correct column index.
By mastering the VLOOKUP function, you can unlock the power of Google Sheets and perform complex data analysis with ease!