Illustrated table showing VLOOKUP product names and prices

Organize the sample data

Put product codes in column A, descriptions in column B, and prices in column C. Add the code you want to search in cell F2. Values such as P1001 and P1002 should be stored consistently, especially when leading zeros are significant.

Build an exact match formula

=VLOOKUP(F2,A2:C20,3,FALSE)

VLOOKUP searches the first column of A2:C20. The number 3 tells it to return the third column of that table, which corresponds to price. FALSE insists on an exact match, making the result safer for identifiers.

Test known and missing identifiers

First enter an existing code in F2 and verify the corresponding price manually. Next, enter a code that does not exist. #N/A is expected for a missing identifier unless your formula includes a deliberate fallback.

What to check if it fails

  • Confirm that the search code appears in the first column of the selected range.
  • Look for extra spaces and incompatible text-versus-number representations.
  • Make sure the return column is included in the table range.
  • Use dollar signs to lock the table range when copying the formula.

Safer maintenance alternatives

For modern Excel versions, XLOOKUP allows separate search and return arrays. INDEX/MATCH is an alternative when compatibility and flexible lookup direction matter. Always test behavior after you insert or remove columns.

Test a lookup formula