How to Use VLOOKUP in Google Sheets
Look up a value in one column and pull back the matching value from another with VLOOKUP, using an exact match and a locked range you can copy down.
You have a price list on one part of the sheet and a list of orders that only shows the product name. VLOOKUP finds each name in the price list and returns the price next to it.
Put the search column first in the lookup table
VLOOKUP only searches the first column of the range you give it, and returns a value from a column to the right of it. Keep the product names in the leftmost column of the table.
For this example, A2:A4 holds Notebook, Stapler, and Desk lamp, and B2:B4 holds 4.50, 12.00, and 38.00, with headers in row 1.
Type the formula
=VLOOKUP("Stapler", A2:B4, 2, FALSE)
search_keyis the value to find, here the text "Stapler".rangeis the block to search. VLOOKUP looks for the search key in the first column of this range only.indexis the column of the range to return, counted from 1. Price is the second column, so 2.is_sortedset to FALSE forces an exact match. Leave it as FALSE unless the first column is sorted and an approximate match is acceptable.
The cell shows 12.
Point the search key at a cell and lock the range
For a list of orders where the product names sit in D2:D20, enter this in E2:
=VLOOKUP(D2, $A$2:$B$4, 2, FALSE)
The $ signs lock the range so it stays on A2:B4 when the formula is copied. Without them the range shifts down one row per copy and the lookups start missing.
Copy the formula down the column
Select E2 and drag the small square at its bottom-right corner down to E20, or double-click it to fill to the end of the neighboring data. Each row now shows the price for the product named in column D.
If the formula returns #N/A. There is no exact match for that search key. Check for spelling differences and trailing spaces in either list. To show something friendlier than the error, wrap the formula: =IFERROR(VLOOKUP(D2, $A$2:$B$4, 2, FALSE), "Not found").
XLOOKUP is the newer alternative. =XLOOKUP(D2, A2:A4, B2:B4) takes the search key, the column to search, and the column to return, in that order. The search column can be anywhere in the table, and there is no column index to count.
More Google Sheets how-tos
- How to Add a Checkbox in Google Sheets
- How to Add a Drop-Down List in Google Sheets
- How to Filter Data in Google Sheets
- How to Freeze a Row in Google Sheets
- How to Highlight Cells with Conditional Formatting in Google Sheets
- How to Make a Chart in Google Sheets
- How to Merge Cells in Google Sheets
- How to Protect a Range in Google Sheets
- How to Remove Duplicates in Google Sheets
- How to Split Text into Columns in Google Sheets
- How to Sum a Column in Google Sheets
- How to Use COUNTIF in Google Sheets
- How to Use IMPORTRANGE in Google Sheets
- How to Use SUMIF in Google Sheets
- How to Use the IF Function in Google Sheets