How to Use XLOOKUP Instead of VLOOKUP (With Examples)

Last updated: December 5, 2026

Quick Answer

Use XLOOKUP instead of VLOOKUP whenever your version of Excel or Google Sheets supports it. XLOOKUP finds a value in one range and returns a matching value from another range — in any direction — without counting columns. Basic form: =XLOOKUP(lookup_value, lookup_range, return_range).

XLOOKUP Syntax

=XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])
  • lookup_value — the value you want to find, for example a student ID.
  • lookup_array — the range to search, for example A2:A6.
  • return_array — the range containing the answer, for example B2:B6.
  • if_not_found — optional message if there is no match, for example “Not found”.

Example: Find a Student’s Grade

Suppose A1:B6 contains student IDs and grades. To find the grade for student S103, use:

=XLOOKUP("S103", A2:A6, B2:B6, "Not found")
Student IDGrade
S101A
S102B
S103A
S104C
S105B

The formula returns A. Compare this with VLOOKUP, where you must also supply a column number and FALSE for an exact match: =VLOOKUP("S103", A2:B6, 2, FALSE).

Why XLOOKUP Is Better Than VLOOKUP

FeatureXLOOKUPVLOOKUP
Search directionLeft or rightRight only
Column countingNot neededRequired
Exact matchDefaultMust add FALSE
Not-found messageBuilt inNeeds IFERROR
Inserting columnsStays correctCan break

Copy-Ready Formulas

Exact match with a friendly message

=XLOOKUP(E2, A2:A100, B2:B100, "Not found")

Look up to the left (VLOOKUP cannot do this)

=XLOOKUP(E2, B2:B100, A2:A100, "Not found")

Find the last matching value

=XLOOKUP(E2, A2:A100, B2:B100, "Not found", 0, -1)

The final -1 searches from last to first, which is useful for finding the most recent entry.

Fixing Common XLOOKUP Errors

#N/A — value not found

Check for extra spaces, different data types (text vs numbers), or a lookup value that really is missing. Add the if_not_found argument to show a friendly message instead: =XLOOKUP(E2, A2:A100, B2:B100, "Not found").

#VALUE! — ranges are different sizes

Your lookup_array and return_array must have the same number of rows. A2:A100 and B2:B100 match; A2:A100 and B2:B90 do not.

#NAME? — function not recognised

Your Excel version may be too old. XLOOKUP requires Microsoft 365 or Excel 2021 and later; Google Sheets supports XLOOKUP. In older versions, use INDEX and MATCH instead.

Frequently Asked Questions

Does XLOOKUP work in Google Sheets?

Yes. Google Sheets supports XLOOKUP with the same basic syntax, so the formulas in this tutorial work in both Excel and Sheets.

Should I stop using VLOOKUP completely?

For new work, prefer XLOOKUP. Keep VLOOKUP only when a file must work in very old Excel versions.

Can XLOOKUP return a whole row?

Yes. If your return_array spans several columns, XLOOKUP returns the matching row across those columns (it “spills” the results into neighbouring cells).

Keep Learning

This article is part of the Excel & Google Sheets Formulas hub, where you will find more formula tutorials with copy-ready examples. Need help with your own spreadsheet? See our Excel & Sheets help service.

About the Author

Syed Ali Mohsin — MS Computer Science (COMSATS), university lecturer with 10+ years of teaching experience in Data Structures & Algorithms, Java/Python OOP, and Computer Organization & Assembly Language.

More about Syed Ali Mohsin · Editorial Policy

Leave a Reply

Your email address will not be published. Required fields are marked *