من أنا
المقالات
الوظائف
التواصل معي

Lookup functions and linking tables

You have a statement, a customer table and a price list on separate sheets. These functions are the bridge that pulls them into a single report.

Chapter 1 · Lesson 4 of 510 min readBeginner level

The idea behind every lookup is the same: take a value you know, find it in a column, and give me back the matching value from another column. What differs is the syntax and how flexible it is.

1 The setup: two tables

The “Items” sheet — the reference table
ABC
1Item codeItem namePrice
2P-101A4 paper18.00
3P-102Printer ink240.00
4P-103Office chair650.00
The “Purchases” sheet — we want to pull the price in beside each code
ABC
1CodeQuantityPrice
2P-1023240.00
3P-1012018.00
4P-9001#N/A

The lookup journey — from code to price in four steps

The “Purchases” sheet
Code Quantity Price
P-102 3 240.00
The “Items” sheet
Item code Item name Price
P-101 A4 paper 18.00
P-102 Printer ink 240.00
P-103 Office chair 650.00
1The value we are looking for: the code on the Purchases sheet
2The lookup column: we scan the item codes
3The matching row: P-102 found
4The return column: we fetch its price

The idea is identical in VLOOKUP and INDEX+MATCH — what changes is how the “return column” is specified: by a column number in VLOOKUP, and by naming the column outright in XLOOKUP and INDEX.

2 XLOOKUP — today’s first choice

fx =XLOOKUP(A2, Items!A:A, Items!C:C, "Not found")
  • First argument: the value you are looking for.
  • Second: the column you search in.
  • Third: the column you return from.
  • Fourth (optional): what to show when nothing is found — so you do not need IFERROR.

Why XLOOKUP is better

It looks both left and right, does not break when a column is inserted, needs no column number, and handles “not found” itself. But it is only available in Microsoft 365 and Excel 2021 or later — so if you share the file with someone on an older version, use the alternatives below.

3 VLOOKUP — the most widespread

fx =VLOOKUP(A2, Items!$A$2:$C$4, 3, FALSE)
ArgumentWhat it meansWarning
A2The lookup value—
$A$2:$C$4The table rangePin it with dollars before filling down
3The number of the column returnedIts meaning changes if a new column is inserted
FALSEExact matchForgetting it gives wrong results rather than errors

Three limitations you must know

First: it searches only the first column of the range and cannot look leftwards. Second: the column number is fixed, so inserting a column in the middle silently breaks every formula. Third: omitting FALSE makes it accept the “closest value”, returning another item’s price without you noticing — an error that slips into reports very easily.

4 INDEX + MATCH — the flexible alternative

fx =INDEX(Items!C:C, MATCH(A2, Items!A:A, 0))
1
MATCH

Finds the row number holding the code

2
0

Exact match

3
INDEX

Returns the value from that row

4
The result

The item’s price

MATCH decides “where”, INDEX fetches “what” — and it works in every version

CriterionXLOOKUPVLOOKUPINDEX+MATCH
Looks leftwardsYesNoYes
Survives inserted columnsYesNoYes
Handles “not found”Built inWith IFERRORWith IFERROR
Works in older versionsNoYesYes
ReadabilityHighMediumTakes getting used to

5 Why does ‎#N/A‎ appear when the value is there?

  • A hidden space on one side or the other — fix it with TRIM.
  • A number against text: code 1001 is a number in one table and text in the other.
  • Look-alike characters: the letter O against the digit 0, or a stray non-Latin character inside a code.
  • An unpinned range that slid as you filled down.
  • The code genuinely is not there — a correct result that deserves following up, not hiding.
fx =IFNA(VLOOKUP(A2, Items!$A$2:$C$4, 3, FALSE), "Item not registered")

Lesson summary

  • XLOOKUP is the first choice if your version supports it.
  • VLOOKUP always needs FALSE and a pinned range.
  • INDEX+MATCH is an alternative that works in every version and survives column changes.
  • ‎#N/A‎ is usually a space or a type mismatch, not a fault in the function.
  • Handle “not found” with an intelligible message, not with blind suppression.

6 Test your understanding

Three quick questions

Pick the answer you believe is correct and you will see the result immediately.

1. The lookup column sits to the right of the column you need to return, and you are on Excel 2016. The solution:

2. What is the danger of omitting FALSE in VLOOKUP?

3. ‎#N/A‎ for a code you can see with your own eyes in both tables. The first thing to check:

Sources and review: function syntax, arguments and version availability follow the official documentation for Microsoft Excel; XLOOKUP is available in Microsoft 365 and Excel 2021 or later. The sheet names and data in the examples are illustrative. Last reviewed: September 2026.