A two-way lookup answers a question such as “What was the revenue for Product B in March?” when product names identify rows and months identify columns. Excel’s INDEX plus two MATCH functions is a reliable way to express the row and column explicitly. The skill is not memorizing a long expression; it is proving that both matches refer to the same data rectangle and that missing or duplicate keys cannot silently corrupt the result.
This is a useful calculation to practice when studying the MO-201 Excel Expert (Office 2019) objectives: selecting exact matches, controlling references, troubleshooting worksheet errors, and deciding when modern dynamic-array functions would be easier to maintain.
MO-201 belongs to the Office 2019 Excel Expert certification track. The Microsoft 365 Apps track uses MO-211, so the exam codes should not be treated as interchangeable. The two-way lookup technique remains valuable in either Excel environment; verify each exam’s published objectives independently.
Build the table and choose the return cell
Suppose worksheet cells A1:M20 contain monthly sales. Column A holds product names, cells B1:M1 hold January through December, and B2:M20 contains numeric sales figures. Put the requested product in P2 and the requested month in Q2. The result must come from exactly one cell in the sales rectangle.
=INDEX($B$2:$M$20,MATCH($P$2,$A$2:$A$20,0),MATCH($Q$2,$B$1:$M$1,0))
MATCH($P$2,$A$2:$A$20,0) returns the product’s one-based row position in the data block. The second MATCH returns the month’s one-based column position. INDEX uses those coordinates to return the intersecting sales value. The final 0 in both MATCH calls requests exact matching; leaving it out can cause approximate matches on unsorted labels.
For a small check, suppose Router appears in A5 and March appears in D1. Because A2 is the first entry in the row lookup range, the row match is 4. Because B1 is the first month, the column match is 3. The formula must therefore return the value at D5, the fourth row and third column of B2:M20. Verify that cell by hand before trusting a copied formula.
Verify row and column alignment independently
For a reliable lookup, the row lookup range must have exactly the same number of rows as the INDEX value array, and the header range must have exactly the same number of columns. If a header is added without expanding the values rectangle, or if the product range starts on the wrong row, MATCH can return a valid position that points to the wrong number.
Test each MATCH in its own cell before nesting. If the product is the third data row and the month is the fourth column of the values rectangle, the intermediate results should be 3 and 4. A wrong coordinate is easier to diagnose than a final formula that appears plausible. Absolute references on the lookup arrays prevent them from sliding when the formula is copied to another report cell; the input references can be fixed or relative according to the reporting layout.
Missing labels, duplicate keys, and misleading IFERROR defaults
An exact MATCH returns #N/A when it cannot find the product or month. That is not a reason to replace every failure with zero: zero revenue and no matching product are different business facts. Where a friendly message is appropriate, prefer a targeted IFNA wrapper such as =IFNA(INDEX($B$2:$M$20,MATCH($P$2,$A$2:$A$20,0),MATCH($Q$2,$B$1:$M$1,0)),"Product or month not found"), while retaining a separate error indicator for auditing.
Duplicates are more subtle. MATCH returns the first matching row or column. If a product name appears twice, the formula does not aggregate both records; it simply chooses the first occurrence. Before using a two-way lookup for critical reporting, enforce unique row identifiers and unique column headers or use a SUMIFS or PivotTable design for records that intentionally have repeated keys. Also check dates and numbers stored as text, leading spaces, and case-sensitive identifiers where exact text identity matters.
Compare with modern XLOOKUP without changing the data contract
In versions of Excel that support dynamic arrays and XLOOKUP, the same two-way problem can be expressed as a nested lookup. The inner XLOOKUP returns the month’s column from the values rectangle, and the outer one selects the requested product from that column.
=XLOOKUP(P2,$A$2:$A$20,XLOOKUP(Q2,$B$1:$M$1,$B$2:$M$20))
Neither formula automatically fixes duplicate keys or a misaligned table. XLOOKUP can be easier to read and supplies an explicit not-found argument, while INDEX with two exact MATCH calls remains useful for compatibility with older workbooks. Prefer the formula your workbook’s audience can inspect, test, and maintain—not the one with the shortest text.
Maintain the matrix when the worksheet evolves
A monthly reporting file often gains a new product or a new period. Fixed $B$2:$M$20 ranges will not automatically include rows or columns appended outside that rectangle. Plan for expansion with a clearly governed table or dynamic named ranges, and test the result after inserting a product and a month. Do not assume that turning a matrix into an Excel Table makes a two-dimensional formula automatically self-maintaining: verify how the row headers, column headers, and value area expand in that particular workbook.
For a workbook used by several teams, document the units and grain of each cell. Is “revenue” before or after refunds? Is March defined by invoice date or settlement date? A technically correct intersection can still mislead when labels represent different business measures. Keep row keys stable, include a source update timestamp, and reconcile a few lookup results against the underlying transactions.
A three-case QA worksheet before relying on the lookup
Test a known product-month intersection and compare it with the source value; test a product or month that does not exist and confirm the formula fails visibly; then deliberately duplicate a product label to demonstrate that a first-match lookup is no longer an appropriate aggregation method. Re-run those cases after a new reporting period is added, after the table is sorted, and after copying the formula into another cell.
The practical lesson is to match each coordinate against its own label range, keep both ranges aligned with the returned array, and make absent or ambiguous data visible. Two-way lookups are dependable when the worksheet’s data contract is explicit and the result can be independently checked.