How to use XLOOKUP in Excel: the modern replacement for VLOOKUP
XLOOKUP (Excel 2021/365) looks left too, shows your own message when nothing is found and needs no column counting. Syntax, all 6 arguments, examples and traps.
XLOOKUP is the lookup function in Microsoft 365, Excel 2021 and newer. It does the job of VLOOKUP, HLOOKUP and INDEX/MATCH in one simple formula.
Three key advantages:
- The lookup column and the return column are given separately — the result can be to the left or right, and you never count columns.
- Exact match by default — no more “forgot FALSE” mistakes like with VLOOKUP.
- You decide what to show when nothing is found — no IFERROR needed.
Example: find an employee’s name by staff number in a directory. The name column is to the left of the staff number — VLOOKUP can’t do that, XLOOKUP does it easily.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Name | Staff No | Department | Salary | |
| 2 | Aziz | T-101 | Sales | 6 500 000 | |
| 3 | Dilnoza | T-102 | Accounting | 7 200 000 | |
| 4 | Javohir3 | T-1032 | IT | 9 800 000 | |
| 5 | Malika | T-104 | Sales | 5 900 000 | |
| 6 | |||||
| 7 | Staff No: | T-1031 | |||
| 8 | Name: | Javohir | |||
| 9 |
Syntax
=ПРОСМОТРX(lookup_value; lookup_array; return_array; [if_not_found]; [match_mode]; [search_mode])
lookup_value— what to find.lookup_array— where to look: a single column or row.return_array— where the result comes from. It must be the same size as the lookup range (B2:B5 → A2:A5).if_not_found— what to show if nothing is found:"Not found", 0 or an empty"".match_mode— 0 exact (default); -1 exact or next smaller; 1 exact or next larger; 2 wildcards (*,?).search_mode— 1 first to last (default); -1 last to first; 2 and -2 — fast binary search in a sorted list.
In practice the first three or four arguments are usually enough.
Writing XLOOKUP step by step
1
Select the result cell (B8). Формулы → Ссылки и массивы → XLOOKUP. If it is not in the list, your Excel version is too old (see the traps below).
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Name | Staff No | Department | Salary | |
| 2 | Aziz | T-101 | Sales | 6500000 | |
| 3 | Dilnoza | T-102 | Accounting | 7200000 | |
| 4 | Javohir | T-103 | IT | 9800000 | |
| 5 | Malika | T-104 | Sales | 5900000 | |
| 6 | |||||
| 7 | Staff No: | T-103 | |||
| 8 | Name: | ||||
| 9 |
2
Arguments: Lookup_value — B7; Lookup_array — the staff number column B2:B5; Return_array — the name column A2:A5; If_not_found — "Not found". Leave Match_mode and Search_mode empty — exact match, top to bottom.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Name | Staff No | Department | Salary | |
| 2 | Aziz | T-101 | Sales | 6500000 | |
| 3 | Dilnoza | T-102 | Accounting | 7200000 | |
| 4 | Javohir | T-103 | IT | 9800000 | |
| 5 | Malika | T-104 | Sales | 5900000 | |
| 6 | |||||
| 7 | Staff No: | T-103 | |||
| 8 | Name: | ||||
| 9 |
3
Click OK — B8 shows “Javohir”. Now type a staff number that isn’t in the list into B7 (say, T-109): instead of #N/A you get “Not found”.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Name | Staff No | Department | Salary | |
| 2 | Aziz | T-101 | Sales | 6 500 000 | |
| 3 | Dilnoza | T-102 | Accounting | 7 200 000 | |
| 4 | Javohir | T-103 | IT | 9 800 000 | |
| 5 | Malika | T-104 | Sales | 5 900 000 | |
| 6 | |||||
| 7 | Staff No: | T-109 | |||
| 8 | Name: | Not found | |||
| 9 |
One formula, several columns
If return_array spans several columns, XLOOKUP returns that part of the row and the result spills into the neighbouring cells:
=ПРОСМОТРX(B7;B2:B5;C2:D5)
One formula returns both the department and the salary. The cells to the right must be empty — otherwise you get a #SPILL! error.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Name | Staff No | Department | Salary | |
| 2 | Aziz | T-101 | Sales | 6 500 000 | |
| 3 | Dilnoza | T-102 | Accounting | 7 200 000 | |
| 4 | Javohir | T-103 | IT | 9 800 000 | |
| 5 | Malika | T-104 | Sales | 5 900 000 | |
| 6 | |||||
| 7 | Staff No: | T-102 | |||
| 8 | Dept, salary: | Accounting | 7 200 000 | ||
| 9 |
Approximate match without sorting: “the smallest plan that fits”
VLOOKUP’s TRUE mode only works on a sorted list and only finds the “smaller” value. XLOOKUP goes both ways, and no sorting is required:
match_mode= -1 — the exact value or the next smaller one (bonus tiers, tax brackets).match_mode= 1 — the exact value or the next larger one (the plan, box or truck that “fits”).
Example: a client needs 12 GB of mobile data a month. The plans are 5, 10, 20 and 50 GB. They need the smallest plan of at least 12 GB — 20 GB:
=ПРОСМОТРX(E2;$A$2:$A$5;$B$2:$B$5;;1)
The 4th argument (if_not_found) is left empty, which is why there are two commas in a row.
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Plan, GB | Price | Client | Needs, GB | Price | ||
| 2 | 10 | 45 000 | Aziz | 121 | 65 000 | ||
| 3 | 50 | 99 000 | Dilnoza | 3 | 30 000 | ||
| 4 | 5 | 30 000 | Javohir | 35 | 99 000 | ||
| 5 | 202 | 65 000 | |||||
| 6 |
Pro level: two-way lookup and the last entry
Two-way lookup. The inner XLOOKUP returns the whole row for a branch, and the outer XLOOKUP picks the month from that row:
=ПРОСМОТРX(B7;B1:D1;ПРОСМОТРX(B6;A2:A4;B2:D4))
Finding the last entry. search_mode = -1 scans the list from the bottom up. A client’s latest purchase in a sales log:
=ПРОСМОТРX("Aziz";B2:B500;C2:C500;"No purchases";0;-1)
It returns a range. XLOOKUP returns a reference, so two XLOOKUPs can be joined with a colon: =СУММ(ПРОСМОТРX("Feb";B1:M1;B2:M2):ПРОСМОТРX("Apr";B1:M1;B2:M2)) sums February through April.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Branch | Jan | Feb | Mar | |
| 2 | Tashkent | 120 | 150 | 140 | |
| 3 | Samarkand1 | 90 | 95 | 1102 | |
| 4 | Bukhara | 70 | 85 | 80 | |
| 5 | |||||
| 6 | Branch: | Samarkand | |||
| 7 | Month: | Mar | |||
| 8 | Sales: | 110 | |||
| 9 |
Try it in the simulator
Type =ПРОСМОТРX(B7;B2:B5;A2:A5;"Not found") in B8 to get the name by staff number. Then type =ПРОСМОТРX(B7;B2:B5;C2:D5) in B9 and watch the department and salary spill into the next cells. Finally, type T-109 in B7.
| A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Name | Staff No | Department | Salary | ||||||||||||||||||||
| 2 | Aziz | T-101 | Sales | 6500000 | ||||||||||||||||||||
| 3 | Dilnoza | T-102 | Accounting | 7200000 | ||||||||||||||||||||
| 4 | Javohir | T-103 | IT | 9800000 | ||||||||||||||||||||
| 5 | Malika | T-104 | Sales | 5900000 | ||||||||||||||||||||
| 6 | ||||||||||||||||||||||||
| 7 | Staff No: | T-103 | ||||||||||||||||||||||
| 8 | Name: | |||||||||||||||||||||||
| 9 | Dept, salary: | |||||||||||||||||||||||
| 10 | ||||||||||||||||||||||||
| 11 | ||||||||||||||||||||||||
| 12 | ||||||||||||||||||||||||
| 13 |
Has ExcelLab been useful?
Support the project and help us release new lessons and exercises.