Sample tutorial: XLOOKUP
By the end of this five-minute lesson, you’ll be able to use XLOOKUP to
pull a value from one table into another, handle missing matches
gracefully, and know why your instructor stopped using VLOOKUP two years
ago.
You’ll need
Section titled “You’ll need”- Excel for Microsoft 365, Excel 2021, or newer (XLOOKUP isn’t in 2019).
- A workbook with two ranges to join — e.g. a list of student IDs and a separate roster with names. The download link (placeholder) will live here in real lessons.
Walk-through
Section titled “Walk-through”1. The basic shape
Section titled “1. The basic shape”XLOOKUP answers the question “given this value, give me the matching
value from another column.”
=XLOOKUP(lookup_value, lookup_array, return_array)So if A2 holds a student ID and the roster lives in Roster!A:B (IDs in
column A, names in column B):
=XLOOKUP(A2, Roster!A:A, Roster!B:B)That’s it. No “fourth argument that’s almost always 0”, no counting columns, no nervous glance at whether the lookup column is on the left.
2. Handle missing matches
Section titled “2. Handle missing matches”Real data has missing rows. The fourth argument lets you say what to
return when nothing matches — instead of #N/A:
=XLOOKUP(A2, Roster!A:A, Roster!B:B, "Not on roster")3. Look left, look right, doesn’t matter
Section titled “3. Look left, look right, doesn’t matter”VLOOKUP could only look to the right of the key column. XLOOKUP
doesn’t care — the lookup array and return array are independent, so you
can fetch a value from a column to the left of your match column with
no gymnastics.
4. Return more than one column
Section titled “4. Return more than one column”Pass a multi-column range as return_array and (in modern Excel) the
result spills sideways:
=XLOOKUP(A2, Roster!A:A, Roster!B:D)You get the matched name, email, and major in one call — three formulas collapsed into one.
Common pitfalls
Section titled “Common pitfalls”Cheat-sheet
Section titled “Cheat-sheet”| You want to… | Formula |
|---|---|
| Look up a name by ID | =XLOOKUP(A2, Roster[ID], Roster[Name]) |
| Show a friendly message when missing | =XLOOKUP(A2, Roster[ID], Roster[Name], "Not on roster") |
| Return several columns at once | =XLOOKUP(A2, Roster[ID], Roster[[Name]:[Major]]) |
| Find the last match instead of the first | =XLOOKUP(A2, Roster[ID], Roster[Name], , 0, -1) |
Try it yourself
Section titled “Try it yourself”- Open the practice workbook (link will go here).
- On the Grades sheet, add a column called
Student name. - Use
XLOOKUPagainst the Roster table to populate it. - Add a fourth argument so missing IDs show
"Not on roster"instead of#N/A.
Take-aways
Section titled “Take-aways”XLOOKUPreplacesVLOOKUP,HLOOKUP, and mostINDEX/MATCHpatterns with one consistent shape.- Always pass the if-not-found argument —
#N/Ain a deliverable is a bug, not a feature. - Reference Tables, not whole columns, in any workbook you’d hand to someone else.