Reliable Excel Lookups
A practical guide to choosing, constructing, and checking Excel lookups, including threshold matches, dynamic-array results, and related calculations.
Retrieve a value or calculate a total?
Retrieve a value or calculate a total?
Start by asking what the result should represent. If you need a field attached to a matching record—such as a product’s price for a given SKU—use a . If you need to total values across every record meeting conditions, use conditional aggregation instead.
For example, this formula totals paid orders in the region named in H2:
=SUMIFS(Orders[Amount],Orders[Region],H2,Orders[Status],"Paid")
SUMIFS adds the qualifying Amount values; it does not retrieve one related field from a single matching record. Also, a total of zero can be a legitimate result. Do not automatically interpret zero as “no matching record.”
Choose the right match behavior
Choose the right match behavior
For identifiers such as SKUs, employee IDs, or invoice numbers, use an . A nearby identifier is not a useful substitute. In a new workbook, XLOOKUP is often the clearest choice: it searches one range and returns a corresponding value from another, even if the return range is to the left. VLOOKUP can suit older workbooks, but the key must be in the first column of its selected table range. INDEX with MATCH is another flexible option, including in older Excel versions.
Suppose G2 contains the SKU to find in a Products table. This XLOOKUP returns its price, or a message if the SKU is absent:
=XLOOKUP(G2,Products[SKU],Products[Price],"SKU not found",0)
XLOOKUP defaults to exact matching, but the final 0 makes that choice explicit. The corresponding VLOOKUP is:
=VLOOKUP(G2,Products[[SKU]:[Price]],2,FALSE)
Here, FALSE requests an , and 2 returns the second column in the selected range. Do not omit VLOOKUP’s final argument for an identifier : omission defaults to approximate matching. INDEX and MATCH can do the same job:
=INDEX(Products[Price],MATCH(G2,Products[SKU],0))
The 0 in MATCH requests an ; this arrangement also does not require the return column to be to the right of the column.
Use approximate matching for thresholds—not as a fallback
Approximate matching is appropriate when sorted values define bands, such as discount tiers. Suppose A2:A5 contains minimum order amounts 0, 50, 100, and 200, while B2:B5 contains the corresponding discount rates. For an order amount in E2:
=XLOOKUP(E2,A2:A5,B2:B5,"Below minimum",-1)
Match mode -1 means or next smaller item. So an order of 125 uses the rate at the 100 threshold. Match mode 1 instead means or next larger item. For this tiered , keep thresholds in ascending order. VLOOKUP’s approximate mode uses TRUE (or an omitted final argument) and likewise requires the first column of the table range to be sorted ascending. Test values at, just below, and just above each boundary to check that the intended band is selected.
Return multiple results with dynamic arrays
Return multiple results with dynamic arrays
In Excel versions that support dynamic arrays, XLOOKUP can return more than one field for a matching key. To retrieve both price and category for the SKU in G2, use:
=XLOOKUP(G2,Products[SKU],Products[[Price]:[Category]],"SKU not found",0)
Enter the formula once in a blank cell. The two returned values into adjacent cells. Keep those cells clear: an occupied cell in the area can cause #!. You cannot enter a spilled formula inside an Excel table, although a formula outside a table can refer to its columns.
To return every product row in the category named in G3, use FILTER:
=FILTER(Products,Products[Category]=G3,"No products found")
This result also spills. Check Excel-version compatibility before sharing a workbook, since dynamic-array behavior and function availability vary by version.
Validate and document the result
Validate and document the result
A formula can be syntactically correct and still return an unintended result. Test a key that should match and one that should be missing. For an approximate , also test values at, just below, and just above the thresholds; these checks show whether boundary values land in the intended bands.
Check that keys have consistent data types and formatting. The number 123 and the text value "123" may not behave as the same key. If a key is supposed to identify one record uniquely, check for duplicates: XLOOKUP returns the first matching result by default.
Record the source table, key, match mode, behavior for missing keys, and any sorting assumption near the formula or in a notes sheet. For dynamic-array formulas, also note the required area and Excel-version needs. These details help someone else tell whether the calculation retrieves an , applies an approximate threshold, or aggregates multiple records.
: The assumptions and checks that explain how a formula should be interpreted and used.