Excel tutorial
/

Functions

Intermediate

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.

Книга1 - Excel
—☐✕
B8fx=ПРОСМОТРX(B7;B2:B5;A2:A5;"Not found")
ABCDE
1NameStaff NoDepartmentSalary
2AzizT-101Sales6 500 000
3DilnozaT-102Accounting7 200 000
4Javohir3T-1032IT9 800 000
5MalikaT-104Sales5 900 000
6
7Staff No:T-1031
8Name:Javohir
9
Готово
T-103 (1) is found in column B (2), and the result comes from column A on the left (3) — VLOOKUP can’t do this

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).

Книга1 - Excel
—☐✕
ФайлГлавнаяВставкаРазметка страницыФормулыДанныеРецензированиеВидСправка
Вставить функциюАвтосуммаФинансовыеЛогическиеТекстовыеДата и времяСсылки и массивыМатематические
Библиотека функций
Диспетчер имён
Определённые имена
B8fx
ABCDE
1NameStaff NoDepartmentSalary
2AzizT-101Sales6500000
3DilnozaT-102Accounting7200000
4JavohirT-103IT9800000
5MalikaT-104Sales5900000
6
7Staff No:T-103
8Name:
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.

Книга1 - Excel
—☐✕
B8fx
ABCDE
1NameStaff NoDepartmentSalary
2AzizT-101Sales6500000
3DilnozaT-102Accounting7200000
4JavohirT-103IT9800000
5MalikaT-104Sales5900000
6
7Staff No:T-103
8Name:
9
ГотовоКоличество: 4

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”.

Книга1 - Excel
—☐✕
B8fx=ПРОСМОТРX(B7;B2:B5;A2:A5;"Not found")
ABCDE
1NameStaff NoDepartmentSalary
2AzizT-101Sales6 500 000
3DilnozaT-102Accounting7 200 000
4JavohirT-103IT9 800 000
5MalikaT-104Sales5 900 000
6
7Staff No:T-109
8Name: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.

Книга1 - Excel
—☐✕
B8fx=ПРОСМОТРX(B7;B2:B5;C2:D5)
ABCDE
1NameStaff NoDepartmentSalary
2AzizT-101Sales6 500 000
3DilnozaT-102Accounting7 200 000
4JavohirT-103IT9 800 000
5MalikaT-104Sales5 900 000
6
7Staff No:T-102
8Dept, salary:Accounting7 200 000
9
ГотовоСреднее: 7200000Количество: 2Сумма: 7200000
The formula is only in B8; the salary in C8 is the spilled result

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.

Книга1 - Excel
—☐✕
F2fx65000
ABCDEFG
1Plan, GBPriceClientNeeds, GBPrice
21045 000Aziz12165 000
35099 000Dilnoza330 000
4530 000Javohir3599 000
520265 000
6
ГотовоСреднее: 64666,6667Количество: 3Сумма: 194000
F2: =XLOOKUP(E2,$A$2:$A$5,$B$2:$B$5,,1). For 12 GB (1) the 20 GB plan (2) is chosen, even though the plans are not sorted

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.

Книга1 - Excel
—☐✕
B8fx=ПРОСМОТРX(B7;B1:D1;ПРОСМОТРX(B6;A2:A4;B2:D4))
ABCDE
1BranchJanFebMar
2Tashkent120150140
3Samarkand190951102
4Bukhara708580
5
6Branch:Samarkand
7Month:Mar
8Sales:110
9
Готово
The inner XLOOKUP returns the Samarkand row (1), the outer one takes March from it (2) — 110 million soums

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.

Книга1 - Excel
—☐✕
Буфер обмена
Шрифт
Выравнивание
Число
Стили
Ячейки
Редактирование
✕✓fx
ABCDEFGHIJKLMNOPQRSTUVWX
1NameStaff NoDepartmentSalary
2AzizT-101Sales6500000
3DilnozaT-102Accounting7200000
4JavohirT-103IT9800000
5MalikaT-104Sales5900000
6
7Staff No:T-103
8Name:
9Dept, salary:
10
11
12
13
Лист1
Готово

Has ExcelLab been useful?

Support the project and help us release new lessons and exercises.

Support us
Previous

96 / 154