墨Inkacuity墨鋒

Inkacuity › Guides › Excel

Excel guide3 min read4 sections

How to use VLOOKUP in Excel (and when to use XLOOKUP)

When two tables need to be matched, such as finding a name from a student ID or a price from a product code, one VLOOKUP fills the whole column without copying and pasting.

By Inkacuity · Updated 2026-11-01

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

  1. Say the sheet "Roster" has IDs in column A and names in column B.
  2. In C2 of your grades sheet, type: =VLOOKUP(A2, Roster!$A:$B, 2, FALSE)
  3. 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.

  1. Formula: =XLOOKUP(A2, Roster!A:A, Roster!B:B, "Not found")
  2. 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.

Related guides

X

Excel pivot table tutorial for beginners

Learn to build a pivot table in Excel: prepare your data, drag fields to rows, columns and values, switch be…

Excel · 3 min read →
X

Excel basics: SUM, IF, COUNTIF and SUMIF in one guide

The Excel functions that cover most needs: SUM, AVERAGE, MAX, MIN, ROUND, IF, IFS, COUNTIF, SUMIF and their …

Excel · 3 min read →
X

Excel table tips: drop-downs, freeze panes, print titles and highlighting

Four practical Excel tricks: make a drop-down list with data validation, freeze the header row, repeat the h…

Excel · 3 min read →