Aral Code

Functions Lesson 8 of 13

Excel VLOOKUP, XLOOKUP and INDEX MATCH

Look up values from a table with VLOOKUP, the newer XLOOKUP, and INDEX with MATCH — prices by item code, names by LRN, and grade brackets with approximate match.

A lookup finds a value in a table and returns related information: the price of an item code, the name of a student from their LRN, the descriptor of a grade. Lookups connect sheets together, like joins in SQL.

The price list

Sheet: Prices
ABC
1CodeItemPrice
2P01Pandesal25
3P02Kape 3-in-18
4P03Itlog9
5P04Noodles15

VLOOKUP

=VLOOKUP(lookup_value, table, column_number, FALSE)
Sheet: Sales
ABCDE
1CodeQtyItemPriceAmount
2P036=VLOOKUP(A2, Prices!$A$2:$C$5, 2, FALSE)=VLOOKUP(A2, Prices!$A$2:$C$5, 3, FALSE)=B2*D2
3P012Pandesal2550

For row 2: Excel finds P03 in the first column of the price table, then returns column 2 (Itlog) or column 3 (9). Amount = 54.

  • The value you look for must be in the first column of the table.
  • The column number counts from the table's first column (1, 2, 3…).
  • FALSE means exact match. Always use it for codes, names and IDs.
  • Lock the table with $ so it doesn't shift when copied down.

XLOOKUP (Microsoft 365, Excel 2021+, Google Sheets)

=XLOOKUP(lookup_value, lookup_range, return_range, "if not found")
=XLOOKUP(A2, Prices!A2:A5, Prices!B2:B5, "Unknown code")

XLOOKUP is easier and safer:

  • The lookup column doesn't have to be first; it can even be to the right of the result.
  • You give the return range directly instead of counting columns.
  • Exact match is the default.
  • A built-in "not found" message replaces #N/A.

If your version has XLOOKUP, prefer it. Use VLOOKUP when sharing files with people who have older Excel versions.

INDEX and MATCH

Before XLOOKUP, the flexible option was combining two functions:

=INDEX(Prices!B2:B5, MATCH(A2, Prices!A2:A5, 0))
  • MATCH(A2, Prices!A2:A5, 0) finds the position of the code (P03 → 3). The 0 means exact match.
  • INDEX(Prices!B2:B5, 3) returns the 3rd item in that range: Itlog.

You'll see INDEX/MATCH in many existing files; it works in every version.

Approximate match: grade brackets

Approximate match is useful for ranges, like converting a grade to a descriptor. The table must be sorted from lowest to highest:

Brackets (F2:G6)
AB
1Min gradeDescriptor
20Did Not Meet Expectations
375Fairly Satisfactory
480Satisfactory
585Very Satisfactory
690Outstanding
=VLOOKUP(B2, $F$2:$G$6, 2, TRUE)

For a grade of 87, Excel finds the largest minimum that's ≤ 87 (85) and returns "Very Satisfactory". This is shorter than a five-level nested IF, and changing a bracket only means editing the table. With XLOOKUP: =XLOOKUP(B2, $F$2:$F$6, $G$2:$G$6, , -1) (match mode -1 = exact or next smaller).

Looking up across sheets

Keep master lists (students, products) on their own sheet and look them up from other sheets. Changing a price in the master list updates every sheet that uses it.

Quick Quiz

Check what you learned. Walang grade ito, practice lang. 🙂

1. What does FALSE mean as VLOOKUP's last argument?
2. Where must the lookup value be in a VLOOKUP table?
3. What does #N/A mean in a lookup?
4. What does MATCH("P03", A2:A5, 0) return if P03 is in A4?

By Sir Reyel · Last updated 2026-12-04