How to use XLOOKUP and VLOOKUP in Excel (with examples to copy)

XLOOKUP and VLOOKUP explained with one worked staff table: exact match, look left, not-found text, salary bands, last match, and how to fix #N/A.

Works on: XLOOKUP: Excel for Microsoft 365, Excel 2024 and Excel 2021. VLOOKUP: every version, including Excel 2019 and 2016 · Time needed: 5 minutes · Published November 9, 2026 · Updated November 23, 2026

Also available in: العربية

Short answer: to look up a value in Excel, use =XLOOKUP(what, where_to_look, what_to_return), for example =XLOOKUP(G2,A2:A6,D2:D6) returns the salary for the employee ID in G2. In Excel 2019 or 2016, which don’t have XLOOKUP, use =VLOOKUP(G2,A2:D6,4,FALSE), and always end VLOOKUP with FALSE for an exact match.

Both functions find a value in one column and bring back the matching value from another. XLOOKUP is newer, simpler and safer; VLOOKUP still works everywhere and fills millions of existing workbooks, so it’s worth knowing both.

The example table used in this guide

Every formula below uses this small staff list in cells A1:D6. Copy it into a blank sheet and try each formula as you read.

Row A B C D
1 Emp ID Name Department Basic salary (AED)
2 E101 Aisha Khan Finance 9,500
3 E102 Omar Haddad IT 12,000
4 E103 Priya Nair HR 8,200
5 E104 Bilal Ahmed IT 10,500
6 E105 Maria Santos Sales 7,800

Type E104 in cell G2: that’s the ID we’ll look up.

XLOOKUP or VLOOKUP: which should I use?

Use XLOOKUP if everyone who opens the file has Excel for Microsoft 365, Excel 2024 or Excel 2021. Use VLOOKUP (or INDEX and MATCH) if the workbook will be opened in Excel 2019 or 2016, where XLOOKUP shows #NAME?. And if a colleague can’t edit the shared workbook at all because Excel says it’s in use, see how to fix an Excel file locked for editing.

Feature XLOOKUP VLOOKUP
Default match Exact Approximate (unless you add FALSE)
Return column A range you select (D2:D6) A column number you count (4)
Look to the left Yes No (use INDEX and MATCH)
Message when nothing is found Built in (if_not_found) Wrap in IFNA
Find the last match Yes (search_mode −1) No
Return several columns at once Yes One column per formula
Survives inserting a column in the table Yes No: the column number now points at the wrong column
Works in Microsoft 365, Excel 2024, Excel 2021 Every version

How do I use XLOOKUP?

XLOOKUP needs three things: the value to find, the column to search, and the column to return.

=XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])

  1. Click the cell where you want the answer (for example H2).
  2. Type =XLOOKUP(G2,A2:A6,D2:D6) and press Enter.
  3. The result is 10500: Bilal Ahmed’s basic salary.

To copy the formula down a column, lock the table ranges with dollar signs so they don’t move: =XLOOKUP(G2,$A$2:$A$6,$D$2:$D$6).

The last three arguments are optional. Microsoft’s XLOOKUP page lists these values:

Argument Value What it does
match_mode 0 (default) Exact match; #N/A if not found
−1 Exact match, or the next smaller item
1 Exact match, or the next larger item
2 Wildcard match: *, ? and ~ have special meaning
search_mode 1 (default) Search from the first item
−1 Search from the last item (finds the last match)
2 / −2 Binary search; the data must be sorted ascending / descending

How do I use VLOOKUP?

VLOOKUP searches the first column of a table and returns a value from a column you specify by number, counting from the left.

=VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])

  1. Click H2.
  2. Type =VLOOKUP(G2,A2:D6,4,FALSE) and press Enter.
  3. The result is 10500. Salary is the 4th column of A2:D6 (A = 1, B = 2, C = 3, D = 4).

Always type FALSE (or 0) at the end unless you want a range match. If you leave it out, VLOOKUP uses an approximate match, which can quietly return the wrong row when the first column isn’t sorted.

Examples you can copy

All results below come from the table above with E104 in G2.

Task Formula Result
Salary for an ID (XLOOKUP) =XLOOKUP(G2,A2:A6,D2:D6) 10500
Salary for an ID (VLOOKUP) =VLOOKUP(G2,A2:D6,4,FALSE) 10500
ID for a name: look to the left =XLOOKUP("Priya Nair",B2:B6,A2:A6) E103
Same in older Excel (INDEX and MATCH) =INDEX(A2:A6,MATCH("Priya Nair",B2:B6,0)) E103
Show text instead of #N/A =XLOOKUP("E109",A2:A6,D2:D6,"Not found") Not found
Same with VLOOKUP =IFNA(VLOOKUP("E109",A2:D6,4,FALSE),"Not found") Not found
Name, department and salary at once =XLOOKUP(G2,A2:A6,B2:D6) Bilal Ahmed, IT, 10500 (in three cells)
First person in IT =XLOOKUP("IT",C2:C6,B2:B6) Omar Haddad
Last person in IT =XLOOKUP("IT",C2:C6,B2:B6,,0,-1) Bilal Ahmed
Name that starts with “Maria” =XLOOKUP("Maria*",B2:B6,D2:D6,,2) 7800

The three-column example “spills”: Excel fills H2, I2 and J2 automatically. Keep those cells empty or you’ll see #SPILL!.

How do I look up a value in a range (salary bands, tiers, rates)?

For bands, you want the row whose starting value is the largest one that isn’t bigger than your number. Put the bands in their own table, starting values in ascending order:

Row J K
1 Salary from (AED) Allowance (AED)
2 0 500
3 8,000 750
4 10,000 1,000
5 12,000 1,500
  • XLOOKUP: =XLOOKUP(D5,J2:J5,K2:K5,,-1) → 1000. A salary of 10,500 has no exact match, so match_mode −1 takes the next smaller value, 10,000.
  • VLOOKUP: =VLOOKUP(D5,J2:K5,2,TRUE) → 1000. This is the one case where VLOOKUP’s TRUE is right, and the first column must be sorted from smallest to largest.

The same pattern works for commission tiers, shipping rates or tax bands. If you only need a percentage worked out, our percentage calculator and the tutorial on calculating a percentage in Excel cover that.

Why does XLOOKUP or VLOOKUP return #N/A (and other errors)?

#N/A means Excel didn’t find the value you’re looking for. Microsoft lists missing values, mismatched types, extra spaces and the wrong match type as the usual causes. Work down this table:

Error or symptom Likely cause Fix
#N/A The value really isn’t in the lookup column Check the spelling, or show a message with if_not_found or IFNA
#N/A on IDs that look identical One side is a number and the other is text (for example 1001 vs '1001) Make both the same type: select the column → Data → Text to Columns → Finish, or convert the lookup value with TEXT() or VALUE()
#N/A with names copied from email or another system Extra spaces before or after the text Clean with =TRIM(B2) and look up the cleaned column
Wrong row returned, no error VLOOKUP without FALSE, on unsorted data Add FALSE as the last argument
#N/A from a range lookup The value is smaller than the first band Add a 0 band at the top, as in the table above
#REF! (VLOOKUP) Column number is bigger than the table (for example 5 on A2:D6) Count the columns again, or switch to XLOOKUP
#NAME? XLOOKUP in Excel 2019 or 2016, a typo in the name, or text without quotes Use VLOOKUP or INDEX and MATCH; put text in “double quotes”
#VALUE! (XLOOKUP) The search and return ranges are different sizes Use ranges with the same rows, for example A2:A6 and D2:D6
#SPILL! A multi-column result has no room Clear the cells to the right or below
Formula breaks when copied down Ranges moved with the formula Lock them: $A$2:$A$6 (press F4)

Formula won’t accept commas? In many regional settings (common with Arabic, French or Spanish number formats) Excel uses a semicolon between arguments: =XLOOKUP(G2;A2:A6;D2:D6). Use whichever separator your Excel shows in the formula tooltip.

Frequently asked questions

What is the difference between XLOOKUP and VLOOKUP?

XLOOKUP returns a value from any column you select, looks left or right, does an exact match by default and has a built-in “not found” message. VLOOKUP returns a column by number, only looks to the right, defaults to an approximate match and works in every Excel version.

Is XLOOKUP available in Excel 2019 or 2016?

No. Microsoft says XLOOKUP is not available in Excel 2016 or 2019. It’s in Excel for Microsoft 365, Excel 2024 and Excel 2021. In older versions use VLOOKUP or INDEX and MATCH.

Why does my VLOOKUP return the wrong value?

Usually because the last argument is missing or TRUE, so VLOOKUP does an approximate match on data that isn’t sorted. Add FALSE: =VLOOKUP(G2,A2:D6,4,FALSE).

How do I hide #N/A in a lookup?

In XLOOKUP, add the text as the fourth argument: =XLOOKUP(G2,A2:A6,D2:D6,"Not found"). With VLOOKUP, wrap it: =IFNA(VLOOKUP(G2,A2:D6,4,FALSE),"Not found"). Use "" instead of “Not found” for a blank cell.

Can XLOOKUP return more than one column?

Yes. Select several columns as the return range, for example =XLOOKUP(G2,A2:A6,B2:D6), and the results spill into the cells to the right.

Updated November 2026. Sources (links re-checked 23 November 2026): Microsoft Support, “XLOOKUP function” (syntax, match_mode 0/-1/1/2, search_mode 1/-1/2/-2; not available in Excel 2016 and 2019), “VLOOKUP function” (exact match with FALSE; lookup value in the first column), “How to correct a #N/A error” and “Quick reference card: VLOOKUP troubleshooting tips”. Worked examples checked by FixAndCalc in a spreadsheet engine (VLOOKUP, INDEX/MATCH, IFNA) and against Microsoft’s documented XLOOKUP behaviour.

Related guides

All calculators

Currency converter & remittance calculator

Daily rates, what your family receives, and a monthly budget.

Percentage calculator

X% of a number, percent of a total, and percentage change.

Discount calculator

Sale price, savings and the real percentage off.

Loan EMI calculator

Monthly instalment, total interest and total repayment for a loan.

Compound interest calculator with monthly contributions

How savings grow with monthly deposits and compound interest.

Salary converter: hourly to monthly and yearly pay

Hourly, daily, weekly, monthly and yearly pay in one step.

Fuel cost calculator: petrol cost for a trip or commute

Petrol cost of a trip or monthly commute, split per person.

VAT calculator: UAE & KSA

Add or remove VAT, with Gulf and other country rates built in.

UAE gratuity calculator

Estimate your end-of-service gratuity under the UAE Labour Law.

UAE leave salary calculator: unused annual leave pay

Your annual leave balance and unused leave pay under UAE Labour Law.

Overtime calculator UAE & Saudi Arabia: pay by labour law

Overtime pay under UAE and Saudi labour law: night, rest day and holiday rates.

Saudi end of service calculator (Articles 84 & 85)

Estimate your end-of-service award under the Saudi Labor Law.

Salary tax calculator Pakistan 2026-27 (tax year 2027)

Income tax on your salary under the 2026-27 slabs, per month and per year.

Age calculator: Gregorian and Hijri (Islamic) age

Exact age in years, months and days, Gregorian and Hijri.

Days between dates calculator (with working days)

Days, weeks, months and working days between two dates.

Gold price calculator UAE: making charges & VAT

Price of gold jewellery or bars from today’s rate, with making charges and VAT.

Zakat calculator: how much zakat do I owe on money and gold?

Zakat on cash, gold, silver and savings, with gold or silver nisab.