Business Analytics & Data Science

B03 · Introductory

Excel for Business Analytics

10 lessons

B03 · Module 2, lesson 1 · Lesson 4 of 10

Lookups: VLOOKUP, INDEX and MATCH, XLOOKUP

Bring a value from one table into another by matching a key: a product’s cost from a price list, a delivery charge from a table of bands. Learn VLOOKUP, INDEX and MATCH, and XLOOKUP, when to match exactly and when approximately, and how to find out why a lookup returns #N/A or, worse, a wrong answer.

About 70 minutes

Before you start

You will be able to

  • Use VLOOKUP with an exact match to bring a value from a lookup table into a list, and explain why leaving out its fourth argument is a trap.
  • Build INDEX and MATCH lookups, including lookups to the left of the key and two-way lookups by a row and a column label.
  • Use XLOOKUP and XMATCH with a not-found value, match modes and search modes, and state which versions of Excel have them.
  • Apply approximate-match lookups to band tables such as delivery charges, and test the boundaries of every band.
  • Diagnose lookups that return #N/A or a wrong value because of spaces, numbers stored as text, misspellings, missing keys or duplicate keys.

Review first

Fictional case A fictional coffee business founded by Ana Lim. It starts as a catering and barista-training service, opens its own cafés and an online shop for beans, and plans a canned cold brew.

The idea

Fictional case

Ana’s spring order sheet lists each order’s product and quantity, but not what the coffee cost Lantern. That is on Kilnworth Roasting’s spring price list: 11 products, each with its line, bag size, Lantern’s shop price and Kilnworth’s cost per item. To cost an order she needs the right unit cost beside it. Typing 231 costs by hand would take an afternoon and invite slips, and when Kilnworth raises its prices in the autumn every typed cost would be out of date.

A lookup formula does the job in one step. It takes the product named in the order row, finds that product in the price list and brings back the value in the same row of the cost column. Filled down the order sheet, it costs every order, and if the price list changes, every cost changes with it.

Every lookup has three parts. The lookup value is what you search for: the product in the order row. The lookup table is the range that holds the keys and the answers: the price list. The return column holds the answer you want: unit_cost. Excel searches the key column for the lookup value and returns the value from the same row of the return column, much as you find a word in a dictionary and read the definition beside it.

Kilnworth’s spring price list as Ana keeps it, in H1:L12 of her order workbook (fictional)
HIJKL
1productlinesize_gpriceunit_cost
2House Blend 250gBlend250$14.00$8.00
3House Blend 1kgBlend1000$46.00$26.00
4Espresso Roast 250gBlend250$15.50$7.80
5Espresso Roast 1kgBlend1000$49.00$24.50
6Colombia Huila 250gSingle origin250$17.00$7.60
7Ethiopia Yirgacheffe 250gSingle origin250$19.50$8.40
8Sumatra Mandheling 250gSingle origin250$18.00$8.10
9Decaf Colombia 250gDecaf250$16.50$7.90
10Decaf Colombia 1kgDecaf1000$54.00$27.00
11Cold Brew PackCold brew480$22.00$8.50
12Gift Box TrioGift750$58.00$20.00

In the order sheet, column A holds the order id, B the product and C the quantity. In D2 Ana types =XLOOKUP(B2,$H$2:$H$12,$L$2:$L$12), which reads: look for B2 in H2:H12 and return the value in the same position of L2:L12. Order LC-10001 is two Gift Box Trios, so D2 shows $20.00. Filled down, B2 becomes B3, B4 and so on, while the dollar signs keep the price list where it is.

Excel offers three ways to write a lookup. VLOOKUP is the oldest and works in every version. INDEX with MATCH also works everywhere and is more flexible. XLOOKUP is the newest and the simplest to read, but among desktop versions only Excel for Microsoft 365, Excel 2021 and Excel 2024 have it. You will meet all three in other people’s workbooks, so this lesson teaches all three.

Each can match in two ways. An exact match returns a result only when it finds a key equal to the lookup value, and #N/A when it doesn’t: right for product names, order ids and customer numbers. An approximate match finds the band a number falls in: the row with the largest lower bound that is not above the value. That is right for delivery charges, quantity discounts and tax bands. Lantern’s July delivery rule (from B01) is a two-row band table: orders up to $35.00 pay $4.95, and orders over $35 travel free.

How the two kinds of lookup search. An exact match scans the key column for an equal value; an approximate match finds the last band whose lower bound is not above the value.

In depth

VLOOKUP

VLOOKUP (“vertical lookup”) searches down the first column of a range and returns a value from a column to its right. It takes four arguments.

VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])
ArgumentWhat it isIn Ana’s formula
lookup_valueThe value to find in the first column of the tableB2, the order’s product
table_arrayThe range holding the keys (first column) and the answers$H$2:$L$12, locked with $
col_index_numWhich column of the range to return, counting the first as 15, column L (unit_cost)
range_lookupFALSE (or 0) for an exact match; TRUE or left out for an approximate matchFALSE

So Ana’s VLOOKUP version is =VLOOKUP(B2,$H$2:$L$12,5,FALSE). It returns the same costs as her XLOOKUP. Without the dollar signs of an absolute reference, filling it down would slide the range to H3:L13, H4:L14 and so on, and the lower rows would stop finding the products near the top of the list.

VLOOKUP has two more weaknesses. First, the lookup value must be in the first column of table_array, so it can’t return anything to the left of the key: to find an order id from a customer number, the customer column must come first. Second, the column number is a constant typed into the formula. If someone inserts a column for supplier codes between line and size_g, Excel widens the range to $H$2:$M$12 but leaves the 5 alone, so the formula now returns column L, which holds the price: Gift Box Trio comes back at $58.00 instead of $20.00. A column number larger than the range is wide gives #REF!.

HLOOKUP is the same function turned on its side: it searches across the top row of a range and returns a value from a row below, with the same fourth argument and the same default. You need it only for tables laid out sideways, such as a rate card with months across the top.

INDEX and MATCH

MATCH finds a position: =MATCH("Cold Brew Pack",$H$2:$H$12,0) returns 10, because Cold Brew Pack is the 10th item in H2:H12. INDEX returns what is at a position: =INDEX($L$2:$L$12,10) returns $8.50, the 10th value in L2:L12. Put together, =INDEX($L$2:$L$12,MATCH(B2,$H$2:$H$12,0)) finds the order’s product in column H and returns the cost from the same position in column L.

The pair fixes both of VLOOKUP’s weaknesses. The return range is separate from the key range, so it can lie to the left. And because both are ordinary references, inserting a column shifts them along with the data, so the formula keeps pointing at the cost. One MATCH can also feed several INDEX formulas, which matters in a large workbook.

INDEX can also take a row number and a column number, which gives a two-way lookup: one MATCH finds the row, another the column. The table below counts Ana’s spring orders by month and channel. To fetch May’s web orders, =INDEX($B$2:$C$5,MATCH("May",$A$2:$A$5,0),MATCH("web",$B$1:$C$1,0)) returns 23. Point the two lookup values at cells holding a month and a channel, and the same formula answers any combination.

Spring orders by month and channel, as a small worksheet (counted from Lantern’s 231 orders)
ABC
1monthappweb
2Mar2336
3Apr2637
4May2623
5Jun2436

XLOOKUP and XMATCH

XLOOKUP keeps the lookup range and the return range apart, as INDEX and MATCH do, and matches exactly unless told otherwise. Its first three arguments are required.

XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])
ArgumentValues and meaning
lookup_valueThe value to find
lookup_arrayThe column (or row) to search
return_arrayThe column (or row) to return from, the same length as lookup_array; several columns return several values
if_not_foundWhat to show when nothing matches; left out, the result is #N/A
match_mode0 exact match (the default); −1 exact match or else the next smaller item; 1 exact match or else the next larger item; 2 wildcard match, where * and ? stand for any characters and ~ escapes them
search_mode1 search from the first item (the default); −1 search from the last item; 2 and −2 binary search, which needs the list sorted ascending or descending

Three of these options solve everyday problems. A not-found value makes a missing key visible: =XLOOKUP(B2,$H$2:$H$12,$L$2:$L$12,"not on price list"). Searching from the last item finds the most recent match in a list kept in date order: in Lantern’s events sheet, with event ids in column A and clients in column C, =XLOOKUP("Pier Nine Studio",$C$2:$C$77,$A$2:$A$77,,0,-1) returns EV-068, the client’s latest event (9 December), while searching from the first item returns EV-003. And a return range of several columns brings back several values at once: =XLOOKUP("Cold Brew Pack",$H$2:$H$12,$I$2:$L$12) returns the line, size, price and cost, which spill into four cells side by side.

XLOOKUP also works on tables laid out across a row, so it replaces HLOOKUP too. XMATCH is MATCH with XLOOKUP’s arguments: it returns a position, matches exactly by default, and takes the same match and search modes. Microsoft’s own two-way example combines them: =INDEX($B$2:$C$5,XMATCH("May",$A$2:$A$5),XMATCH("web",$B$1:$C$1)) gives the same 23 as the INDEX and MATCH version.

Approximate match: lookups into bands

A band table lists the lower bound (“from”) of each band in its first column, sorted from smallest to largest, with each band’s result beside it. An approximate match returns the result of the last band whose lower bound is not above the lookup value. The formula card below states the rule; the figure above shows it working.

Two band tables from the case: the July delivery rule (F1:G3) and Ana’s order-size bands (I1:J5)
F: fromG: chargeI: fromJ: band
1fromchargefromband
2$0.00$4.95$0.00Under $20
3$35.01$0.00$20.00$20 to $39.99
4$40.00$40 to $99.99
5$100.00$100 and over

With the order value in B2, any of three formulas returns the delivery charge: =VLOOKUP(B2,$F$2:$G$3,2,TRUE), =XLOOKUP(B2,$F$2:$F$3,$G$2:$G$3,,-1) (match mode −1: exact match or else the next smaller item) and =INDEX($G$2:$G$3,MATCH(B2,$F$2:$F$3,1)). The size band is the same idea with four rows: =XLOOKUP(B2,$I$2:$I$5,$J$2:$J$5,,-1).

The boundary needs care. B01’s rule is free delivery on orders over $35, and order values are whole cents, so the free band starts at $35.01 and an order of exactly $35.00 pays $4.95. Typing 35 in the table would hand a $35.00 order free delivery that the rule doesn’t give. Test every boundary with a value just below it, one exactly on it and one just above it: 34.99, 35.00 and 35.01 here. Test the bottom too: a value below the first lower bound, such as a −12.60 refund, has no band and returns #N/A.

Keep band tables sorted. Microsoft documents that VLOOKUP’s approximate match and MATCH with match_type 1 assume the first column is sorted from smallest to largest, and that XLOOKUP’s binary search modes give invalid results on unsorted data. XLOOKUP’s default search reads every item, so its match_mode −1 copes with an unsorted table, but a sorted table is the one a reader can check at a glance. Why not use IF? =IF(B2>35,0,4.95) works for two bands, but four size bands need nested IFs with the thresholds buried inside the formula, while a band table puts the rule where anyone can read and change it.

Why a lookup returns #N/A, or the wrong answer

An #N/A from an exact-match lookup is an error value that means “no key equal to this one”. Microsoft’s list of the usual causes covers four of the rows below: the value really isn’t there, the two sides hold different data types, there are extra spaces, and the match type is wrong. The wrong match type, the unlocked range and the duplicate key are the dangerous ones, because they can give a plausible number instead of an error. Two tests help with types: =ISTEXT(B2) is TRUE when B2 holds text, and =ISNUMBER(B2) is TRUE when it holds a number.

Diagnosing a lookup
CauseWhat you seeHow to testFix
Extra spaces: “Cold Brew Pack ” with a trailing space#N/A=LEN(B2) is longer than the name looksTRIM the key, or look up TRIM(B2)
A number stored as text on one side: “10144” against 10144#N/A=ISTEXT(B2) and =ISNUMBER(H2) disagreeConvert one side so both match: VALUE for text to number, &"" for number to text
A different spelling: “Ethiopia Yirgachefe”#N/ACompare with the list; =COUNTIF($H$2:$H$12,B2) is 0Correct the source or add a mapping table
The key isn’t in the table: a new product#N/ASearch the list for itAdd it, or flag it with if_not_found or IFNA
Approximate match by accident: VLOOKUP without FALSEA wrong value, or sometimes #N/ARead the fourth argumentType FALSE (or 0)
The table range wasn’t lockedRight in the top rows, #N/A or wrong lower downShow Formulas and read a lower rowAdd $ to the table range
The key appears twiceThe first match, no error=COUNTIF($H$2:$H$12,H2) above 1Remove or merge the duplicate

Handle a genuine miss on purpose. XLOOKUP’s if_not_found, or =IFNA(VLOOKUP(B2,$H$2:$L$12,5,FALSE),"not on price list") in versions without XLOOKUP, labels the rows that need attention. Don’t wrap lookups in IFERROR to make the errors go away: IFERROR also hides a #REF! or #VALUE! from a broken formula, and a cost replaced by 0 or a blank understates the product cost without anyone noticing. The functions-and-logic lesson compares IFERROR and IFNA.

Duplicate keys deserve a check of their own. Microsoft’s developer reference for VLOOKUP says that when two or more values in the first column match, the first value found is used; MATCH with 0 finds the first value exactly equal to the lookup value; and XLOOKUP searches from the first item unless told otherwise. A price list with House Blend 250g twice, at two costs, would return the first cost for every order, right or not. Fill =COUNTIF($H$2:$H$12,H2) down beside the key column: any result above 1 is a duplicate key to resolve (B02’s duplicates lesson covers how).

Which lookup to use

The three ways compared
VLOOKUPINDEX and MATCHXLOOKUP
VersionsAllAllMicrosoft 365, 2021 and 2024
Default matchApproximate (type FALSE)MATCH approximate (type 0)Exact
Return a column left of the keyNoYesYes
Survives an inserted columnNo: the column number staysYesYes
When the key is missing#N/A (wrap in IFNA)#N/A (wrap in IFNA)if_not_found argument
Several columns at onceNoNo, without extra workYes, they spill

Use XLOOKUP when everyone who opens the workbook has a version that supports it; use INDEX and MATCH when someone may open it in Excel 2019 or earlier; and learn to read VLOOKUP, because it fills the workbooks you will inherit. Whichever you write, check the match type, lock the table range and test a key you know.

Formulas

Approximate-match (band) lookup

result=rk,k=max⁡{ i:fi≤v }\text{result} = r_k, \quad k = \max\{\, i : f_i \le v \,\}
vv
The lookup value, such as an order valueas the table
fif_i
The lower bound (“from”) of band i; the bounds are sorted so that f₁ < f₂ < …as v
rir_i
The result for band i, such as its delivery charge or its labelany
ii
A band’s position in the table, counting from the top
kk
The band the value falls in: the last band whose lower bound is not above v

Assumes. VLOOKUP with TRUE and MATCH with match_type 1 need the “from” column sorted from smallest to largest; XLOOKUP’s default search reads every item, so its match_mode −1 also works on an unsorted table (keep it sorted anyway, so people can check it). If v is below the first lower bound, no band qualifies and the lookup returns #N/A.

VLOOKUP with TRUE, MATCH with match_type 1 and XLOOKUP with match_mode −1 all apply this rule.

Worked examples

A first example: The product cost of five orders

Fictional figures

Ana wants the product cost (what the coffee cost Lantern) of the first five spring orders. The orders are in A1:C6 of her sheet and Kilnworth’s price list in H1:L12, as in the table under The idea. Write the unit-cost formula, fill it down, and work out each order’s product cost.

The order sheet with the formulas in row 2 (filled down to row 6)
A: order_idB: productC: quantityD: unit_costE: product_cost
2LC-10001Gift Box Trio2=XLOOKUP(B2,$H$2:$H$12,$L$2:$L$12)=C2*D2
3LC-10002Colombia Huila 250g2(filled)(filled)
4LC-10003House Blend 250g1(filled)(filled)
5LC-10004House Blend 250g3(filled)(filled)
6LC-10005House Blend 1kg2(filled)(filled)
  1. Decide the match type. Products are keys, so the lookup must be exact; XLOOKUP matches exactly by default (with VLOOKUP you would type FALSE).
  2. Write D2 so that it fills down correctly: B2 is relative, so it moves to B3, B4…, and the two price-list ranges carry $ so they stay on H2:H12 and L2:L12.
  3. Read the results. D2 to D6 show $20.00, $7.60, $8.00, $8.00, $26.00 (Gift Box Trio, Colombia Huila 250g, House Blend 250g twice, House Blend 1kg).
  4. Multiply by the quantity in E: 2 × $20.00 = $40.00; 2 × $7.60 = $15.20; 1 × $8.00 = $8.00; 3 × $8.00 = $24.00; 2 × $26.00 = $52.00.
  5. Check one result by hand against the price list: House Blend 1kg costs $26.00 a bag, and LC-10005 has two, so $52.00. Then add the column: $139.20.

Answer. The five orders cost Lantern $40.00, $15.20, $8.00, $24.00 and $52.00: $139.20 in all.

What it means. One formula, filled down, costs every order and stays right when Kilnworth’s list changes. The same formula over all 231 orders is the first step of the course project, where Ana turns these costs into her margin figures.

A harder example: Delivery charges and size bands, boundaries included

Fictional figures

Ana wants to know what six spring orders would have paid under the July delivery rule, and which size band each falls in. She adds two test values, $35.00 and $35.01, to check the boundary. The bands are in F1:G3 and I1:J5 as in the table under In depth.

Six orders and two test values, with the formulas in row 2 (filled down)
A: orderB: order_totalC: deliveryD: size band
2LC-10003$14.00=VLOOKUP(B2,$F$2:$G$3,2,TRUE)=XLOOKUP(B2,$I$2:$I$5,$J$2:$J$5,,-1)
3LC-10004$37.00$0.00$20 to $39.99
4LC-10015$34.00$4.95$20 to $39.99
5LC-10038$35.10$0.00$20 to $39.99
6LC-10001$111.00$0.00$100 and over
7LC-10019$31.00$4.95$20 to $39.99
8test$35.00$4.95$20 to $39.99
9test$35.01$0.00$20 to $39.99
  1. Choose approximate matching: the order values are not in the table, and each must land in the band whose lower bound is the largest one not above it. VLOOKUP needs TRUE; XLOOKUP needs match_mode −1.
  2. Check the tables are sorted ascending by “from”: 0, 35.01 and 0, 20, 40, 100. Approximate matching relies on that order.
  3. Read the delivery column. LC-10003 ($14.00) pays $4.95; LC-10004 ($37.00) pays $0.00; LC-10015 ($34.00) pays $4.95; LC-10038 ($35.10) pays $0.00; LC-10001 ($111.00) pays $0.00; LC-10019 ($31.00) pays $4.95. Three of the six would pay, $14.85 between them.
  4. Check the boundary rows: $35.00 pays $4.95 because it is not over $35, and $35.01 travels free. Had the table said 35 instead of 35.01, the $35.00 test would show $0.00, contradicting the rule; none of the six real orders would change, which is exactly why the test values are needed.
  5. Read the size bands: LC-10003 Under $20; LC-10004 $20 to $39.99; LC-10015 $20 to $39.99; LC-10038 $20 to $39.99; LC-10001 $100 and over; LC-10019 $20 to $39.99. LC-10038 at $35.10 is free to deliver but still in the $20 to $39.99 band, because the two tables have different boundaries.
  6. Finally, see what goes wrong with an exact match: =VLOOKUP(B2,$F$2:$G$3,2,FALSE) finds no order value equal to 0 or 35.01, so all six rows show #N/A.

Answer. Three of the six orders (LC-10003, LC-10015, LC-10019) would pay $4.95 each; the other three travel free. The test values confirm that $35.00 pays and $35.01 is free.

What it means. An approximate match is only as good as its band table. Writing the boundary as 35.01 encodes “over $35” exactly, and the two test rows prove it; a table that is wrong by one cent would pass every real order in this sample and still be wrong. The project applies the same lookup to all 231 orders.

Applied: a business decision: Three lookups fail at a bike shop

Fictional figures

Spokewise Cycles, a fictional bike shop, reorders six parts. Its reorder sheet holds part numbers as numbers in A2:A7; the supplier’s new price file is pasted into H1:I7, beside it. The buyer’s formula =XLOOKUP(A2,$H$2:$H$7,$I$2:$I$7) finds only three prices, and a colleague suggests wrapping it in IFERROR with 0 so the total adds up. Should she?

The reorder sheet (A:C) and the supplier’s file as pasted (H:I); columns D to G are empty (fictional)
A: part_noB: partC: qtyH: part_noI: unit_price
1part_nopartqtypart_nounit_price
210432Brake pads (pair)2010432 (number)$6.40
310433Inner tube 700c30“10433” (text)$4.10
410440Chain, 11-speed8“10440 ” (text)$18.50
510451Bar tape1210451 (number)$7.25
610458Tyre levers (set)2510458 (number)$2.30
710466Mudguard set610471 (number)$12.90
  1. Test the failures before hiding them. Parts 10433 and 10440 are in the file, but =ISTEXT(H3) is TRUE: the supplier exported them as text, so the number 10433 is never equal to the text “10433”. Part 10440’s key also has a trailing space, which =LEN(H4) shows as 6 characters instead of 5.
  2. Fix the key, not the result. In a helper column G, =VALUE(TRIM(H2)) filled down turns every supplier key into a number with no spaces. Then look up against it: =XLOOKUP(A2,$G$2:$G$7,$I$2:$I$7,"not in supplier file").
  3. Now 5 of 6 parts find a price, and the mudguard set (10466) is flagged: it is genuinely missing, perhaps discontinued, which is a question for the supplier, not a formula. (Part 10471 in the file is one Spokewise isn’t reordering.)
  4. Compare the totals. With IFERROR and 0, the reorder would have cost $272.50 on paper; with the keys fixed, the five priced parts cost $543.50. The IFERROR version understated the order by $271.00 and hid the missing part.

Answer. No. Two of the three failures were type and space problems in the supplier’s keys, fixed with VALUE and TRIM; only one part is really missing, and it should be flagged, not costed at $0. The reorder costs $543.50 for five parts, plus the mudguards once the supplier confirms a price.

What it means. An error value is information. Replacing it with 0 would have turned “we can’t find this price” into “this part is free” and sent a purchase order $271.00 short. Diagnose each #N/A, fix the key where the key is at fault, and flag what is really missing.

Explore

Eight spring orders, Kilnworth’s price list and the July delivery bands. Click Show formulas to read the lookups. Then break them on purpose: delete ,FALSE from a VLOOKUP and see which costs change; type a space after a product name in column B; change a cost in the price list and watch the order rows follow; change 35.01 in the band table to 35 and type 35 into an order value.

Loading the interactive…

Common mistakes

  • “VLOOKUP finds the matching row.”

    Only if you ask for an exact match. Its fourth argument defaults to TRUE, an approximate match that assumes a sorted first column; on an unsorted list it returns plausible wrong values without any error. Type FALSE every time you look up a key, or use XLOOKUP, which is exact by default.

  • “The formula worked in the first row, so it works all the way down.”

    Without dollar signs on the table range, filling down slides the range: by row 10 it starts eight rows below the top of the list, and the products above it can no longer be found. Lock the table range ($H$2:$L$12) and check a row near the bottom.

  • “#N/A means the product isn’t on the list.”

    Often it is there, but stored differently: a trailing space, a number stored as text, or a slightly different spelling. Test with LEN, ISTEXT and ISNUMBER, and fix the key. Only when the key really is missing should you flag it with if_not_found or IFNA.

  • “Wrap it in IFERROR and the errors go away.”

    They go away from view, not from the data. IFERROR replaces every error, including the #REF! of a broken formula, and a cost of 0 makes totals look complete when they aren’t. Use IFNA or if_not_found with a visible message, and count the rows that carry it.

  • “Over $35 means the band starts at 35.”

    An approximate match puts a value equal to a lower bound in that band, so a band starting at 35 includes $35.00. For “over $35” in whole cents the band starts at 35.01. Test every boundary with a value just below, exactly on and just above it.

  • “A lookup returns every matching row.”

    VLOOKUP, MATCH and XLOOKUP return one match: the first, unless XLOOKUP is told to search from the last. If the key column has duplicates, the others are ignored. Check the key column with COUNTIF before relying on it, or use FILTER (next lesson) when you really want every match.

Guided practice

Work through these with hints when you need them. Every hint and every worked solution is there to be used.

Loading four questions…

On your own

No hints this time. Answer, check, and read the feedback; the solution appears once you have answered or if you ask for it. Your first answers count toward mastery.

Loading six questions…

In practice

Kilnworth’s autumn prices. When Kilnworth sends its autumn list, Ana pastes it over the spring one, and every cost in the order sheet updates at once. She adds “not on price list” as XLOOKUP’s not-found value, so a product Kilnworth has renamed or dropped shows up immediately instead of costing nothing. To see which costs rose, she keeps the spring list beside the new one and looks each product up in both, a side-by-side comparison that would take an hour to type by hand.

A hotel’s rate card. Ridgeline Lodge, a fictional hotel, prices rooms by room type (rows) and season (columns). Its booking sheet finds each booking’s nightly rate with a two-way INDEX and MATCH, so the revenue manager can change one cell of the rate card and see every quote move. Because the reservations team uses an older version of Excel, the workbook avoids XLOOKUP.

Commission tiers. A sales team paid 2% commission on monthly sales of up to $10,000, and 3% on all its sales in a month when they are above $10,000, uses a band table and an approximate match, not a nested IF. Before payroll, the analyst runs the boundary test ($9,999.99, $10,000.00 and $10,000.01) against the policy wording, because “above $10,000” and “from $10,000” differ by exactly the cent the test checks.

Matching payments to invoices. A finance team looks up each bank payment’s invoice number in the invoice list with XLOOKUP and “unmatched” as the not-found value. The unmatched rows are the reconciliation’s to-do list: typos in references, payments covering two invoices, or money that belongs to someone else. This is B02’s referential-integrity check done with a lookup: every key in one table should point to a row in the other.

Knowledge check

Six questions, one attempt each, no hints. Score 80% or more to complete the lesson; you can take it again at any time.

Loading six questions…

Summary

  • A lookup finds a lookup value in the key column of a lookup table and returns the value from the same row of a return column; fill it down with the table range locked by $.
  • VLOOKUP needs FALSE for an exact match, can’t look left of its key, and breaks when a column is inserted; INDEX with MATCH (match_type 0) fixes both weaknesses and works in every version.
  • XLOOKUP is exact by default, takes a not-found value, can search from the last item and can return several columns; it and XMATCH need Excel for Microsoft 365, 2021 or 2024.
  • Approximate matching returns the result of the last band whose lower bound is not above the value; keep band tables sorted and test every boundary (“over $35” starts at 35.01).
  • #N/A usually means a key stored differently (spaces, text versus number, spelling), not a missing one; diagnose with LEN, ISTEXT and ISNUMBER and fix the key.
  • Handle genuine misses with IFNA or if_not_found and a visible message; IFERROR with 0 hides broken formulas and understates totals.
  • Lookups return the first match only, so check key columns for duplicates with COUNTIF.

Key formulas

Terms introduced

Lookup value
The value a lookup formula searches for, such as the product named in an order row.
Lookup table
A range holding the keys a lookup searches and the values it can return, such as a price list or a table of bands.
Exact match
A lookup that returns a result only when it finds a key equal to the lookup value, and #N/A when it doesn’t.
Approximate match
A lookup that, when no key equals the lookup value, returns the row of the largest key below it (or, in some modes, the smallest key above it); used with band tables sorted by their lower bounds.
Two-way lookup
A lookup that finds a value by its row label and its column label at once, for example with INDEX and two MATCH functions.
Spill
What a formula that returns several values does in Excel for Microsoft 365, Excel 2021 and Excel 2024: the results fill the neighbouring cells, the spill range, starting from the formula’s cell.

Sources

  1. Microsoft Support. VLOOKUP function. support.microsoft.com/en-us/Excel/vlookup-function
  2. Microsoft Support. XLOOKUP function. support.microsoft.com/excel/functions/xlookup-function
  3. Microsoft Support. MATCH function. support.microsoft.com/en-au/office/match-function-e8dffd45-c…
  4. Microsoft Support. XMATCH function. support.microsoft.com/en-us/office/xmatch-function-d966da31-…
  5. Microsoft Support. How to correct a #N/A error. support.microsoft.com/en-us/excel/how-to-correct-a-n-a-error
  6. Microsoft Learn. WorksheetFunction.VLookup method (Excel). Describes the worksheet function’s handling of duplicate keys and sorted data. learn.microsoft.com/en-us/office/vba/api/excel.worksheetfunc…