Tabellab

Advanced Lookups: Two-Way, Multi-Criteria and Tiers

Lesson 1 of 22Lab

All lessons
  1. Advanced Lookups: Two-Way, Multi-Criteria and TiersLabFree
  2. Multi-Criteria SUMIFS, COUNTIFS, AVERAGEIFS and MAXIFSLab Locked
  3. SUMPRODUCT with Boolean ArraysLab Locked
  4. Array Math inside SUM, AVERAGE, MAX and MATCHLab Locked
  5. Nested Logic: IFS, SWITCH, CHOOSE and IFERRORLab Locked
  6. Text Formulas: FIND, MID, SUBSTITUTE, TEXT and TEXTJOINLab Locked
  7. Date & Time Formulas: EOMONTH, NETWORKDAYS, WEEKNUM, HOURLab Locked
  8. Statistical Formulas: RANK, PERCENTRANK, LARGE and Conditional MEDIANLab Locked
  9. Financial Formulas: PMT, PPMT, NPV and XNPVLab Locked
  10. Mid-course project: Audit and Repair a Broken ReportLab Locked
  11. Lookup Edge Cases: Last Match, Wildcard Search and Fallback ChainsLab Locked
  12. Point-in-Time Lookups: Price on a Date, Last Order and Days SinceLab Locked
  13. Criteria Lists: Array Constants, Membership Tests and Exclusion ListsLab Locked
  14. Expanding Ranges: Running Totals, Nth Order and Credit-Limit ChecksLab Locked
  15. Text Classification: Keyword Categories, Code Parsing and Code ChecksLab Locked
  16. Due Dates & Receivables Aging: WORKDAY Roll-Forward and Aging BucketsLab Locked
  17. 2D Conditional Sums: SUMPRODUCT over Grids with Row and Column CriteriaLab Locked
  18. Outlier Checks: Z-Scores, Conditional Percentiles and TRIMMEANLab Locked
  19. Returns & Payback: IRR, Cumulative Cash Flow and the Payback YearLab Locked
  20. Scenario Switch & Two-Way Sensitivity Grid: Price × VolumeLab Locked
  21. Control Checks: Cross-Footing, Duplicate Numbers and Unknown KeysLab Locked
  22. Final Project: April Regional Performance Report with Dashboard ChartLab Locked

You are not signed in — the lab works, but your progress is not saved. Sign up

Lesson 1 of 22 is free. Unlock all 22 hands-on labs, the final exam and your certificate.

Buy course — €9.90
Loading the spreadsheet…

Why simple lookups stop working

Most people learn VLOOKUP, feel productive for a week, and then hit the wall. The price list has regions across the top and products down the side, so a single lookup column is not enough. The stock report lists the same SKU in three warehouses, so the first match is the wrong match. The discount sheet says “10% from 50 units”, and nobody has a row for 37 units. These are the three lookup problems that turn up again and again in purchasing, sales operations, finance and inventory work, and they are exactly what this free lesson solves.

This guide is for anyone who already knows what a basic lookup does and now needs formulas that hold up in a real workbook: analysts who build price calculators, controllers who reconcile stock, sales coordinators who quote volume discounts, and students preparing for an Excel assessment. You will work with the fictional wholesaler Cairnfield Outdoor Supply, which sells tents, sleeping bags, stoves and backpacks from three warehouses. The numbers in this article are the same numbers you see in the interactive lab above, so you can read a step here and immediately try it in the sheet.

By the end you will be able to write a two-way lookup with INDEX and two MATCH functions, a multi-criteria lookup in two different ways, and an approximate-match tier lookup for discounts, commissions or tax-style bands. You will also know the mistakes that make these formulas return a wrong number without any error message, which is the most expensive kind of spreadsheet bug.

The core idea: a lookup is just a position

Every lookup in Excel answers the same two questions: where is the item I am looking for, and what is stored at that position in another range? VLOOKUP hides those two steps inside one function, which is convenient until you need more control. The advanced techniques in this lesson simply make the two steps explicit.

  • MATCH (or XMATCH) answers where: it returns a position number, such as 4 for the fourth row of a range.
  • INDEX answers what: give it a range and a row number (and optionally a column number) and it returns the value at that spot.
  • XLOOKUP does both in one function and adds options for “not found” values and approximate matches.
  • A boolean array such as (A14:A21="Reno") is a list of TRUE/FALSE values. Multiply two of them and TRUE×TRUE becomes 1, everything else 0, which lets you search for “the row where both conditions are true”.

Once you think in positions, the three problems become small variations. A two-way lookup needs two positions, one for the row and one for the column. A multi-criteria lookup needs one position that satisfies several tests. A tier lookup needs the position of the largest lower bound that is still not bigger than your number.

Worked example 1: the two-way price lookup

Cairnfield’s list price for each product depends on the sales region. Freight and local competition differ, so the same two-person tent costs $245 in the East and $265 in the West. The price matrix sits in A1:E7 of the lab: SKUs in column A, regions in row 1, prices in B2:E7.

Cairnfield Outdoor Supply list prices by region (sheet range A1:E7)
SKUNorthSouthEastWest
TNT-2P$249$259$245$265
TNT-4P$389$399$379$409
BAG-20$129$135$125$139
BAG-35$179$185$172$189
STV-01$64.50$66$62.50$68
PCK-45$149$155$145$159

A sales coordinator types a SKU into B9 (for example BAG-35) and a region into B10 (East) and wants the price in B11. The formula is:

=INDEX(B2:E7, MATCH(B9, A2:A7, 0), MATCH(B10, B1:E1, 0))

  • MATCH(B9, A2:A7, 0) searches the SKU list for BAG-35 and returns 4, because BAG-35 is the fourth item in A2:A7.
  • MATCH(B10, B1:E1, 0) searches the region headers for East and returns 3.
  • INDEX(B2:E7, 4, 3) goes four rows down and three columns across inside the price block and returns $172.
  • The final 0 in each MATCH means exact match. Leave it out and MATCH assumes a sorted list and may return a neighbouring item.

INDEX(B2:E7, MATCH("BAG-35",…), MATCH("East",…))NorthSouthEastWestTNT-2P249259245265TNT-4P389399379409BAG-20129135125139BAG-35179185189STV-0164.56662.568PCK-45149155145159172row 4(MATCH 1)column 3 (MATCH 2)
Figure 1. The row MATCH and the column MATCH each return a position; INDEX returns the price where the highlighted row and column cross.

The ranges must line up. The price block starts in column B, so the column headers must also start in column B: B1:E1, not A1:E1. If you include A1, East becomes position 4 and INDEX returns the West price of $189, a wrong answer with no error. The same rule applies to rows: the SKU list A2:A7 starts in row 2, exactly like B2:E7.

In Microsoft 365 you can write the same lookup as a nested XLOOKUP: =XLOOKUP(B9, A2:A7, XLOOKUP(B10, B1:E1, B2:E7)). The inner XLOOKUP returns the whole East column, and the outer one picks the BAG-35 row from it. Both versions are correct; INDEX/MATCH works in every Excel version still in use, which matters when you share files with colleagues on older installations.

Worked example 2: finding stock by warehouse AND SKU

The stock list in A13:D21 has one row per warehouse and SKU. The two-person tent TNT-2P appears three times: in Denver, Reno and Boise. If you look up only the SKU, Excel stops at the first TNT-2P row and gives you Denver’s 42 units even though you asked about Reno. You need a lookup that matches both keys.

Stock list A13:D21 with the two tests Excel evaluates in memory
WarehouseSKUOn handReorder atA=RenoB=TNT-2PProduct
DenverTNT-2P4230010
DenverBAG-351825000
DenverSTV-019560000
RenoPCK-456440100
RenoTNT-2P2735111
RenoBAG-353325100
BoiseTNT-2P5145010
BoiseSTV-011240000

Method 1: join the keys. The ampersand joins text. B23&B24 turns Reno and TNT-2P into the single key RenoTNT-2P, and A14:A21&B14:B21 builds the same kind of key for every row of the list, in memory, without a helper column. The formula in B25 is:

=XLOOKUP(B23&B24, A14:A21&B14:B21, C14:C21) → 27 units on hand.

Method 2: multiply boolean tests. (A14:A21=B23) returns eight TRUE/FALSE values, one per row, and so does (B14:B21=B24). Multiplying them converts TRUE to 1 and FALSE to 0, so the product is 1 only where both tests are true. Then you look up the number 1:

=XLOOKUP(1, (A14:A21=B23)*(B14:B21=B24), D14:D21) → reorder point 35.

WarehouseSKU=Reno?=TNT-2P?ProductDenverTNT-2P0×1=0DenverBAG-350×0=0DenverSTV-010×0=0RenoPCK-451×0=0RenoTNT-2P1×1=1RenoBAG-351×0=0BoiseTNT-2P0×1=0BoiseSTV-010×0=0← row 5is returned
Figure 2. Two TRUE/FALSE columns multiplied together. Only the fifth row, Reno and TNT-2P, produces a 1, so XLOOKUP(1, …) returns that row.

The result is useful straight away: Reno holds 27 tents but reorders at 35, so it is already below its reorder point. Denver’s BAG-35 (18 against 25) and Boise’s STV-01 (12 against 40) are in the same situation, which you could flag with =IF(C14<D14,"Reorder","") next to each row.

Which method should you use? Joining keys is short and easy to read, but it can create false matches when the joined text is ambiguous (for example “AB”&“C” and “A”&“BC” both become ABC). Put a separator in both places, such as B23&"|"&B24 and A14:A21&"|"&B14:B21. The boolean method never has that problem and also accepts conditions like (C14:C21>20), so it scales better to three or more criteria.

If you work in Excel 2019 or older, XLOOKUP is not available. The classic equivalent is =INDEX(D14:D21, MATCH(1, (A14:A21=B23)*(B14:B21=B24), 0)). In those versions you must confirm it with Ctrl+Shift+Enter so Excel treats it as an array formula; in Microsoft 365 a normal Enter is enough because arrays calculate natively.

Worked example 3: volume discounts with a tier table

Cairnfield gives wholesale customers a discount that grows with order quantity. In this example the tiers are 0% below 10 units, 4% from 10, 7% from 25 and 10% from 50 units. The tier table lists only the lower bound of each band, in ascending order: 0, 10, 25 and 50 in A29:A32, with the rates in B29:B32. An order of 37 units has no row of its own, and it does not need one.

=XLOOKUP(B35, $A$29:$A$32, $B$29:$B$32, , -1)

The fifth argument, match mode -1, means “exact match, or if there is none, the next smaller item”. For 37 units there is no exact 37, so XLOOKUP takes the next smaller bound, 25, and returns its rate of 7%. The fourth argument is left empty, which is why you see two commas in a row. The dollar signs lock the tier table so that the formula can be copied from C35 down to C40.

Order discounts from the tier table A29:B32 (Min qty 0 / 10 / 25 / 50)
OrderQtyTier it falls intoDiscountFormula in column C
SO-510180 – 90%=XLOOKUP(B35,$A$29:$A$32,$B$29:$B$32,,-1)
SO-51022525 – 497%same formula, copied down
SO-51033725 – 497%…
SO-51046050 and more10%…
SO-51051210 – 244%…
SO-51064925 – 497%…

0%2%4%6%8%10%12%010203040506070Order quantity (units)82537601249Discount by order quantity (tier starts at Min qty)
Figure 3. The tier table drawn as steps. Each order (dot) takes the rate of the step it stands on; an order of exactly 25 units already gets the 7% rate.

Look at SO-5102 with exactly 25 units. Because 25 is an exact match, it gets 7%, not 4%. That is the correct reading of “from 25 units”. Tier tables are where boundary mistakes hide, so always test the exact bound values (10, 25, 50) and one value on each side of them.

Older formulas do the same job: =VLOOKUP(B35, $A$29:$B$32, 2, TRUE) and =INDEX($B$29:$B$32, MATCH(B35, $A$29:$A$32, 1)). Both rely on the bounds being sorted in ascending order. If someone inserts a new tier at the bottom of an unsorted list, they silently return the wrong rate. XLOOKUP with match mode -1 searches the whole list for the best candidate, so it does not depend on the sort order, although a sorted tier table is still easier for people to read.

How to do it in Excel, step by step

  1. Lay out the data first. Keep the price matrix as one block with labels on the top row and in the first column, no blank rows inside it, and put input cells (SKU, region, warehouse) in a clearly marked area. Use Home > Styles > Cell Styles > Input to colour them.
  2. Build the two MATCH functions on their own first. In a spare cell type =MATCH(B9,A2:A7,0) and check that it returns 4. Do the same for the region. Testing the pieces is much faster than debugging the finished formula.
  3. Wrap them in INDEX. Type =INDEX(B2:E7,, paste the row MATCH, a comma, the column MATCH, and close the bracket. Press Enter.
  4. Test with changed inputs. Use Data > Data Tools > Data Validation > List to turn B9 and B10 into drop-downs with source =$A$2:$A$7 and =$B$1:$E$1. Now nobody can type a SKU that does not exist.
  5. Write the multi-criteria lookup. In B25 type =XLOOKUP(B23&B24,A14:A21&B14:B21,C14:C21). In B26 use the boolean version for the reorder point.
  6. Inspect the array. Click into the formula bar, select only (A14:A21=B23)*(B14:B21=B24) and press F9. Excel shows {0;0;0;0;1;0;0;0}. Press Esc to leave the formula unchanged. Formulas > Formula Auditing > Evaluate Formula does the same step by step.
  7. Add the tier lookup. In C35 type =XLOOKUP(B35,A29:A32,B29:B32,,-1), select the two table ranges inside the formula and press F4 to make them absolute, then copy down with a double-click on the fill handle or Ctrl+D.
  8. Handle missing values. Give XLOOKUP a fourth argument such as "not stocked", or wrap INDEX/MATCH in IFERROR(…, "not stocked"), so a typo shows a clear message instead of #N/A.
  9. Audit. Press Ctrl+` to show all formulas, and use Formulas > Trace Precedents on B11 to confirm it points at the right ranges.

Advanced Excel formulas course: lookup, SUMIFS and array formula labs
The Advanced Excel Formulas & Functions Masterclass: twenty hands-on labs, from lookups to a full report audit.

Common mistakes and how to spot them

  • Misaligned header range. MATCH(B10,A1:E1,0) instead of B1:E1 shifts every result one column. Spot it by checking that the first cell of each MATCH range sits in the same row or column as the first cell of the INDEX range.
  • Row and column swapped. INDEX expects the row number first. If a tent suddenly costs $66, you have probably fed the region position in as the row. Test with a SKU whose prices are very different from its neighbours.
  • Missing match type. MATCH(B9,A2:A7) without the 0 defaults to approximate match on an unsorted list. It may return a plausible but wrong row. Always type the 0 for exact lookups.
  • Only one criterion matched. A lookup on the SKU alone returns Denver’s 42 tents instead of Reno’s 27. Spot it by changing the warehouse input: if the result does not move, the warehouse is not part of the formula.
  • Wrong match mode for tiers. Match mode 1 (exact or next larger) moves an order of 37 units into the 10% band. Test with values just above each bound.
  • Relative references in the tier table. Without $ signs the table range slides down as you copy, and the last orders look up empty cells. Click a lower formula and look at its references.
  • Hidden spaces and number-as-text. “Reno ” with a trailing space never equals “Reno”. Use =LEN(A17) to check, and TRIM or Data > Text to Columns to clean imported keys.
  • Blanket IFERROR. Wrapping everything in IFERROR(…,0) hides real problems. A missing price shown as $0 is worse than a visible #N/A. Return a text message instead, and only where a missing value is expected.

Quick reference

Quick reference: functions and shortcuts used in this lesson
Function or keyWhat it doesExample from this lesson
INDEX(array, row, col)Returns the cell at a row and column position inside a range=INDEX(B2:E7,4,3) → 172
MATCH(value, range, 0)Position of an exact match in a one-row or one-column range=MATCH("East",B1:E1,0) → 3
XLOOKUP(value, lookup, return, [not found], [mode])Looks up a value and returns the matching item; mode -1 = exact or next smaller=XLOOKUP(B37,A29:A32,B29:B32,,-1) → 7%
XMATCH(value, range, [mode])Modern MATCH with exact match as the default=XMATCH(B10,B1:E1) → 3
&Joins text, also whole ranges in a dynamic-array formulaA14:A21&B14:B21
(range=value)*(range=value)Turns two TRUE/FALSE arrays into 1s and 0s; 1 = both true(A14:A21=B23)*(B14:B21=B24)
IFERROR(value, fallback)Replaces any error with a fallback value=IFERROR(XLOOKUP(…),"not stocked")
F4Cycles a reference through $A$1, A$1, $A1 and A1Lock the tier table before copying down
F9In the formula bar, shows the result of the selected partSelect the boolean product to see {0;0;0;0;1;0;0;0}
Ctrl+Shift+EnterConfirms an array formula in Excel 2019 and olderNeeded for the INDEX/MATCH boolean version there
Ctrl+`Shows formulas instead of resultsAudit the whole lookup block at once

Real-world uses

  • Price and freight calculators. A quote sheet looks up the price for a product and customer group, or freight cost by weight band and destination zone, with one two-way lookup.
  • Inventory control. Stock, reorder points and lead times are stored per warehouse and item. A two-criteria lookup feeds a reorder report that updates when the stock export is pasted in.
  • Sales commissions and bonuses. Commission rates often rise in bands of revenue. An approximate-match tier lookup keeps the rates in one small table that HR can change without touching formulas.
  • Budget versus actual by cost centre and month. The budget is a matrix of cost centres by month; INDEX with two MATCH functions pulls the right budget figure next to each actual posting.
  • Shipping and service levels. Delivery promises depend on carrier and region, and surcharges depend on parcel size bands. Combining a two-way lookup with a tier lookup handles both in one sheet.

What you will build in the rest of this course

This lesson is the first of twenty. The other nineteen labs use the same kind of realistic business data and check every formula as you type, so you learn by building rather than by watching.

Multi-Criteria SUMIFS, COUNTIFS, AVERAGEIFS and MAXIFS. Lookups return one value; the IFS family summarises many. You total revenue inside a date window, count tent orders with a wildcard, find the largest order while excluding one sales rep, and build a region × channel grid where one formula, anchored correctly, fills every cell.

SUMPRODUCT with Boolean Arrays. The boolean trick from this lesson grows up. You calculate net revenue without a helper column, combine AND and OR conditions inside one SUMPRODUCT, and learn why a simple average of discount rates is wrong and how a weighted average fixes it.

Array Math inside SUM, AVERAGE, MAX and MATCH. You analyse Q3 budget versus actual with single-cell array formulas: total absolute variance, average deviation, the number of lines outside tolerance and the line with the biggest overrun, all without extra columns that someone could break.

Nested Logic: IFS, SWITCH, CHOOSE and IFERROR. You replace long chains of nested IFs with readable logic: translate tier codes, grade customers on two conditions, map dates to an April-to-March fiscal quarter and return a clean fallback when a lookup finds nothing.

Text Formulas: FIND, MID, SUBSTITUTE, TEXT and TEXTJOIN. Real exports are messy. You pull a weight out of a product description, count tags in a cell, build price labels with proper number formatting and list every SKU under a price limit in a single cell.

Date & Time Formulas: EOMONTH, NETWORKDAYS, WEEKNUM, HOUR. You set invoice due dates at month end, count business days while skipping closing days, assign Monday-based week numbers and flag the orders that made the same-day shipping cutoff.

Statistical Formulas: RANK, PERCENTRANK, LARGE and Conditional MEDIAN. You rank a sales team, show each rep’s percentile, average the top three results and find the median revenue of one region, which tells you more than an average distorted by one huge deal.

Financial Formulas: PMT, PPMT, NPV and XNPV. You work out the monthly payment on a van loan and how much of each payment is principal, value a warehouse expansion with NPV and compare a supplier deal with irregular payment dates using XNPV.

Mid-course project: Audit and Repair a Broken Report. Everything comes together in a colleague’s monthly report that is full of errors, including one line that is wrong without showing any error at all. You trace each problem to its cause and write the repaired formula, the skill that makes you the person others ask for help.

Summary

Advanced lookups are about positions. MATCH or XMATCH finds where something is, INDEX returns what is there, and XLOOKUP combines both with useful options. Two MATCH functions give you a two-way lookup, joined keys or multiplied boolean tests give you a multi-criteria lookup, and match mode -1 turns a short tier table into a correct discount for any quantity. The habits matter as much as the syntax: align your ranges, always state the match type, lock tables with F4 and test the boundary values.

Now scroll back up to the lab and try it yourself: price BAG-35 in the East, find Reno’s TNT-2P stock with both methods and fill in the six order discounts. Change the inputs afterwards and watch every result update. That is the moment these formulas stop being syntax and start being tools you trust.

Frequently asked questions

How do I do a two-way lookup in Excel?

Use INDEX with two MATCH functions: =INDEX(data, MATCH(row key, row labels, 0), MATCH(column key, column headers, 0)). The first MATCH finds the row, the second the column, and INDEX returns the value where they cross.

How do I look up a value with two criteria in Excel?

Either join the keys, as in =XLOOKUP(B23&B24, A14:A21&B14:B21, C14:C21), or multiply boolean tests and look up 1, as in =XLOOKUP(1, (A14:A21=B23)*(B14:B21=B24), D14:D21). The boolean version also works with conditions such as greater than.

Is INDEX MATCH better than VLOOKUP?

INDEX MATCH can look to the left, does not break when columns are inserted and can match a row and a column at the same time. VLOOKUP is shorter for simple cases, and in Microsoft 365 XLOOKUP replaces both for most tasks.

What does match mode -1 do in XLOOKUP?

It returns an exact match or, if there is none, the next smaller item. That is exactly what tier tables need, where each band is listed by its lower bound.

Why does my INDEX MATCH return the wrong value without an error?

Usually the MATCH range does not line up with the INDEX range, for example headers A1:E1 against data B2:E7, or the match type 0 is missing. Check that both ranges start in the same row or column.

Can I use these formulas without Microsoft 365?

INDEX and MATCH work in every Excel version. XLOOKUP needs Excel 2021 or Microsoft 365; in older versions, use INDEX/MATCH and confirm boolean array formulas with Ctrl+Shift+Enter.

Keep going: Advanced Excel Formulas & Functions Masterclass

This free lab is lesson 1 of 22. Unlock the other 21 hands-on labs, the final exam and your certificate for a one-time €9.90.

  1. Multi-Criteria SUMIFS, COUNTIFS, AVERAGEIFS and MAXIFS
  2. SUMPRODUCT with Boolean Arrays
  3. Array Math inside SUM, AVERAGE, MAX and MATCH
  4. Nested Logic: IFS, SWITCH, CHOOSE and IFERROR
  5. Text Formulas: FIND, MID, SUBSTITUTE, TEXT and TEXTJOIN
  6. Date & Time Formulas: EOMONTH, NETWORKDAYS, WEEKNUM, HOUR
  7. Statistical Formulas: RANK, PERCENTRANK, LARGE and Conditional MEDIAN
  8. Financial Formulas: PMT, PPMT, NPV and XNPV
  9. Mid-course project: Audit and Repair a Broken Report
  10. Lookup Edge Cases: Last Match, Wildcard Search and Fallback Chains
  11. Point-in-Time Lookups: Price on a Date, Last Order and Days Since
  12. Criteria Lists: Array Constants, Membership Tests and Exclusion Lists
  13. Expanding Ranges: Running Totals, Nth Order and Credit-Limit Checks
  14. Text Classification: Keyword Categories, Code Parsing and Code Checks
  15. Due Dates & Receivables Aging: WORKDAY Roll-Forward and Aging Buckets
  16. 2D Conditional Sums: SUMPRODUCT over Grids with Row and Column Criteria
  17. Outlier Checks: Z-Scores, Conditional Percentiles and TRIMMEAN
  18. Returns & Payback: IRR, Cumulative Cash Flow and the Payback Year
  19. Scenario Switch & Two-Way Sensitivity Grid: Price × Volume
  20. Control Checks: Cross-Footing, Duplicate Numbers and Unknown Keys
  21. Final Project: April Regional Performance Report with Dashboard Chart

Buy course — €9.90 See the full course