01The four arguments of VLOOKUP
The formula looks like this: =VLOOKUP(lookup_value, table_array, col_index_num, FALSE)
- lookup_value: what you are searching for, for example the ID in A2.
- table_array: the range to search. The value you look up must be in the first column of this range.
- col_index_num: which column of the range to return, counting from 1.
- FALSE: exact match. Always use FALSE for IDs and codes, or you may get a wrong row.
02Example: find a name from a student ID
- Say the sheet "Roster" has IDs in column A and names in column B.
- In C2 of your grades sheet, type: =VLOOKUP(A2, Roster!$A:$B, 2, FALSE)
- Press Enter, then drag the small square at the bottom right of C2 down to fill the column.
Tip Lock the lookup range with $ (press F4 to toggle) so it does not shift when you drag the formula down.
03What to do about #N/A
- The values look the same but one is a number and the other is text. Format both columns the same way and try again.
- There are spaces before or after the value. Clean it with =TRIM(A2).
- The value really is missing. Wrap the formula: =IFERROR(VLOOKUP(…), "Not found").
- The value you search for is not in the first column of the range. VLOOKUP can only look to the right, so use XLOOKUP instead.
04Newer Excel: use XLOOKUP
Microsoft 365 and Excel 2021 or later have XLOOKUP. It does not need a column number and can look to the left.
- Formula: =XLOOKUP(A2, Roster!A:A, Roster!B:B, "Not found")
- The first argument is the value to find, the second is the column to search, the third is the column to return, and the fourth is the text to show when nothing matches.
Q&AFAQ
Should I use VLOOKUP or XLOOKUP?
If your version of Excel has XLOOKUP, use it. It is easier to read and harder to get wrong. Use VLOOKUP only when the file will be opened in an older version of Excel.
Does it work in Google Sheets?
Yes. VLOOKUP and XLOOKUP are written the same way in Google Sheets.
Rather have it done for you?
Document and Excel help, from about us$9. Report writing, data organizing and basic Excel work: tables, formulas, pivot tables and charts, usually delivered within a day or two.