Lesson 5 of 8 · see all lessons
  1. Formulas from zero

    1. 1. Excel basics: cells, ranges and your first SUM formula
    2. 2. Relative vs absolute references in Excel ($A$1)
    3. 3. How to use the IF function in Excel (and nested IF)
  2. Answer questions with conditions and lookups

    1. 4. SUMIFS and COUNTIFS in Excel: add and count with conditions
    2. 5. How to use XLOOKUP in Excel (and VLOOKUP when you have to)
  3. Organize and summarize the month

    1. 6. How to sort, filter and make a table in Excel
    2. 7. How to make a pivot table in Excel
    3. 8. Excel practice: build a monthly sales report

12 min

How to use XLOOKUP in Excel (and VLOOKUP when you have to)

XLOOKUP finds a value in one column and returns the matching value from another. Learn it step by step, fix #N/A, and read an old VLOOKUP.

By the end of this lesson you can

  • Write XLOOKUP with its three required parts
  • Fill a lookup down a column with $ on the lookup ranges
  • Turn #N/A into a clear message, and find the first or last match
  • Read and repair a VLOOKUP someone else wrote

From earlier lessons · 1 of 2

Which formula adds the Totals of coffee rows?

Pick one answer.

From earlier lessons · 2 of 2

What does ">="&DATE(2026,3,16) do as a SUMIFS criterion?

Pick one answer.

The café's costs live in a separate menu list. Typing 30 costs into the sales rows by hand means 30 chances for a typo. A lookup fetches each one for you, and tells you when it can't find one.

Take a guess

You ask a lookup for the cost of a Mocha. The menu has no Mocha. What does XLOOKUP return if you give it nothing else?

No pressure. Guess now, and the lesson will show you if you were right.

[6]

Paste the menu

The café's costs sit in a small menu list: what one unit of each item costs the café to make. Copy the block below and paste it into cell S1. Column R stays empty so the menu stays separate from the sales rows.

text
Menu item Unit cost
Espresso 0.60
Latte 0.90
Cappuccino 0.85
Green Tea 0.40
Chai 0.70
Croissant 1.10
Muffin 1.00
Sandwich 3.20
Paste into S1. Check: S2 says Espresso, T9 says 3.20.

XLOOKUP in three parts

XLOOKUP searches one column for a value and returns the value from the same row of another column. Three parts are required:

  1. lookup_value: what to find, such as the item in C2
  2. lookup_array: where to search, the menu items S2:S9
  3. return_array: what to bring back, the costs T2:T9

It looks for an exact match by default. XLOOKUP isn't in Excel 2016 or 2019. It is in Microsoft 365, Excel 2021 and later, and Google Sheets (checked November 2026).

[6][16]

Put in order

Put the parts of the cost lookup in order.

Drag, or focus an item and press Space, move with the arrow keys, then Space to drop.

  1. C2
  2. =XLOOKUP(
  3. ,$T$2:$T$9
  4. ,$S$2:$S$9
  5. )

[6]

excel
M1: Unit cost
M2: =XLOOKUP(C2,$S$2:$S$9,$T$2:$T$9) (fill down to M31)
N1: Profit
N2: =E2*(F2-M2) (fill down)
P15: Profit Q15: =SUM(N2:N31)
Expected: M2 0.90 (Latte), M3 1.10 (Croissant), N2 20.80. Q15 434.65, the café's March profit after ingredient costs.

Step through

XLOOKUP("Chai", S2:S9, T2:T9): scanning the menu for row 11

  1. Espresso0look
  2. Latte1
  3. Cappuccino2
  4. Green Tea3
  5. Chai4
  6. Croissant5
  7. Muffin6
  8. Sandwich7

Start at the top. Espresso isn't Chai.

Step 1 of 6

[6]

Why do the menu ranges in M2 need $ signs, but C2 doesn't?

Pick one answer.

[8]

[6][17]

excel
=XLOOKUP("Mocha",$S$2:$S$9,$T$2:$T$9,"Not on menu")
Expected: Not on menu. Change "Mocha" to "Chai" and it shows 0.70.

[6]

Look things up in the sales rows

XLOOKUP stops at the first match, searching from the top. The sixth part, search_mode, changes direction: -1 searches from the last row up. And the return column can sit anywhere, even to the left of the column you search.

[6]

excel
=XLOOKUP("Sandwich",C2:C31,G2:G31)
=XLOOKUP("Sandwich",C2:C31,G2:G31,"none",0,-1)
=XLOOKUP("Sandwich",C2:C31,A2:A31)
Type each one in an empty cell, such as Q17. Expected: Chloe sold the first sandwich line and Ana the last. The third returns 4 March 2026, but Excel may show 46085 until you format the cell as a date.

Predict, then reveal

What does =XLOOKUP(MAX(H2:H31),H2:H31,C2:C31) return?

[6][18]

VLOOKUP, for older files

You'll meet VLOOKUP in older workbooks. It searches the first column of a table and returns the column you name by number, counting from 1. Its last part matters most: FALSE means exact match. Leave it out and VLOOKUP uses approximate match, which expects a sorted first column.

[18]

excel
=VLOOKUP(C2,$S$2:$T$9,2,FALSE)
Expected: 0.90, the same as the XLOOKUP. Column 2 of S:T is T, the cost.

A colleague's VLOOKUP has no FALSE at the end, and our menu isn't sorted. What's the risk?

Pick one answer.

[18]

What does =VLOOKUP(C2,$S$2:$T$9,3,FALSE) return?

Pick one answer.

FlashcardsIndex cardsFlashcards ⚡

Card 1 of 18

Worth keeping

  1. XLOOKUP needs what to find, where to look and what to bring back.
  2. Lock the lookup ranges with $ before you fill down.
  3. #N/A means no match: check spelling and spaces, then add an if_not_found message.
  4. In old VLOOKUPs, check for FALSE at the end and a column number that fits the table.

Column N now shows profit on every line. The manager scrolls up and down: which lines were biggest? Just show me Ben's food. Sorting answers that in two clicks. But sort one column the wrong way, and every Total lands next to the wrong item, with no error.

Embed this practice on your site

Free for classrooms, blogs and study groups. Paste this into any page that accepts HTML.

Report a copyright problem with this lesson

Sources for this lesson (5)

Each fact in the lesson is marked with the number of the page it comes from.

  1. [6]Microsoft Support: XLOOKUP function
  2. [8]Microsoft Support: Switch between relative, absolute, and mixed references
  3. [16]Google Docs Editors Help: XLOOKUP function
  4. [17]Microsoft Support: How to correct a #N/A error
  5. [18]Microsoft Support: VLOOKUP function