XLOOKUP vs VLOOKUP: When a Replacement Formula Changes the Result
Hundreds of VLOOKUP formulas in your order workbook already return the right prices. Which of them will give a different answer once you swap in XLOOKUP?

Replace the lookup rule, not just the function name
An order workbook may contain hundreds of VLOOKUP formulas that already produce the intended prices. Switching to XLOOKUP can make return ranges easier to maintain, especially when columns move. It does not decide which duplicate price is current, repair inconsistent identifiers or make an older recipient's Excel support a newer function.
Begin with a copy of the workbook and add a replacement-result column beside the existing one. This gives you somewhere to compare a normal product, an unknown product and a duplicated product before the new formula feeds an invoice total. Keep approximate lookups, such as quantity discounts, in a separate group during this review: their intended behavior differs from an exact product-code match.
The examples use a small fictional catalog. Enter the Code, Item and Price columns in A1:C5, leaving out the Row column, which only identifies the worksheet positions. Place the requested code in F2. The amounts are illustrative numbers rather than actual product prices.
| Row | A: Code | B: Item | C: Price |
|---|---|---|---|
| 2 | P-10 | Notebook | 25 |
| 3 | P-20 | Pen set | 48 |
| 4 | P-30 | Folder | 32 |
| 5 | P-20 | Pen set | 52 |
An exact-match replacement on the same data
=VLOOKUP(F2,$A$2:$C$5,3,FALSE)
=XLOOKUP(F2,$A$2:$A$5,$C$2:$C$5) The VLOOKUP formula searches the first column of its table and returns column three. The XLOOKUP formula searches one range and returns the corresponding position from another. With P-20 in F2, the ordinary forward search returns the first matching price, 48, in both cases. Neither formula chooses 52 merely because it appears farther down.
The dollar signs keep catalog references fixed when you copy the formula down. F2 can become F3 while the catalog remains A2:C5. These examples use comma separators; installations configured for semicolons require the corresponding local separator. Microsoft's VLOOKUP reference and XLOOKUP reference describe the respective argument structures.
The final FALSE matters in the VLOOKUP example. Omitting it selects approximate matching, which expects an appropriately sorted first column and may return an unintended result on an unsorted catalog. XLOOKUP uses exact matching by default. That default reduces one omission in a product lookup; it does not establish that the catalog itself is correct.
An approximate lookup needs an intentional conversion
A quantity discount is a different problem. Suppose H2:H4 contains lower thresholds of 0, 10 and 50, while I2:I4 contains discounts of 0%, 5% and 10%. An order for 27 units should use the band beginning at 10. Here, VLOOKUP's approximate mode is deliberate.
=VLOOKUP(F2,$H$2:$I$4,2,TRUE)
=XLOOKUP(F2,$H$2:$H$4,$I$2:$I$4,"No band",-1) For this example F2 holds the quantity, not a product code. XLOOKUP's fifth argument, -1, requests an exact match or the next smaller value. It therefore selects the threshold 10 for a quantity of 27. Without that argument, the new formula looks for an actual row containing 27 and returns the missing-result message instead.
For a table whose rows mean “up to 10 units” and “up to 50 units,” an order of 27 belongs to the row with an upper limit of 50. Set XLOOKUP's fifth argument to 1 to request an exact match or the next larger value. The lower-threshold example uses -1 because it needs the opposite direction. Microsoft's match-mode reference defines both choices. Test a boundary quantity and one between boundaries to establish that the replacement preserves the intended bands.
Return ranges make column changes easier to follow
To find a code from an item name, place that name in F2 and use =XLOOKUP(F2,$B$2:$B$5,$A$2:$A$5). The return range is to the left of the lookup range. A basic VLOOKUP cannot directly use that layout because its lookup column must be the leftmost column of its table. An INDEX and MATCH combination is another way to support that arrangement.
Now insert a Specification column between B and C in a separate copy of the catalog. Price moves to D. A VLOOKUP whose table expands to A2:D5 still has the literal return index 3, which now identifies Specification. An XLOOKUP that directly referenced the old price column normally follows that reference to D during the worksheet column insertion. You can see the practical difference by inspecting both formulas after the insertion. The remaining examples use the original three-column catalog, so their references still point to A through C.
Searching A2:A5 while returning C3:C6 uses equally sized ranges with different starting rows. P-10 matches the first lookup position, so it receives C3: the pen set's price of 48, instead of the notebook's 25. This produces a wrong price rather than a missing-code message. Align both ranges to rows 2 through 5 to connect each code to its own price.
The last match is not necessarily the newest record
Return to the catalog and put P-20 back in F2. =COUNTIF($A$2:$A$5,F2) returns 2. This reveals that the catalog contains more than one matching key before you decide which record the order should use. The COUNTIF documentation describes counting cells that satisfy a criterion.
If your catalog is intentionally maintained so that the bottommost entry is the applicable price, a reverse search can implement that rule:
=XLOOKUP(F2,$A$2:$A$5,$C$2:$C$5,"Unknown code",0,-1) The fifth argument retains exact matching. The sixth starts searching from the end, so this table returns 52. It does not compare dates. Sorting the table by price or appending an older historical record can change which row is last. A workbook that must choose the newest effective date needs a rule based on that date, rather than an assumption about row position.
Duplicates can also be legitimate. The same product may have different contract prices for different customers. In that case, a product code alone does not identify the desired record. Removing the second row would lose information, while switching functions would leave the ambiguity intact. Build a lookup key that identifies the actual contract item, or prepare a catalog with one applicable row per requested item.
Several output columns versus every matching row
With =XLOOKUP(F2,$A$2:$A$5,$B$2:$C$5), the result can contain the item name and price from one matching row. For P-20, those are Pen set and 48. Leave adjacent output cells empty so the result can expand into them. Enlarging the return range does not turn this into a list of every P-20 record.
For a review of both matching rows, use a filter instead:
=FILTER($A$2:$C$5,$A$2:$A$5=F2,"Unknown code") This returns the matching records as a list, which serves a different purpose from filling one invoice price. Microsoft's FILTER reference explains that its result spills to the required size and can provide a message when no rows match. Put the output somewhere with enough empty space. The list lets a reviewer see both prices before deciding which rule the order workbook needs.
Make missing data visible during the changeover
XLOOKUP's fourth argument can display “Unknown code” when no match is found. Test P-99, which is absent from the example. Returning zero instead may make a missing catalog entry look like a valid zero-priced item. Returning an empty string can make the gap less obvious. During migration, a visible message makes the row easier to investigate before totals are used.
If an apparently present code is still missing, compare its stored type and surrounding spaces with the source value. A numeric identifier and a text identifier can look identical on screen. Microsoft's #N/A guidance identifies type mismatches and extra spaces as possible causes. Normalize a helper column and compare it with the original before replacing business identifiers indiscriminately.
Finish the comparison with normal, missing and duplicated keys, plus the boundary values for banded calculations. Then try the edits people actually make to the catalog: inserting a column, appending a product and sorting records. A fixed range ending at row 5 does not automatically search every future row. The new formula should cover the data the workbook is expected to receive.
Finally, check the Excel versions used by people who must recalculate the file. Microsoft explicitly excludes Excel 2016 and 2019 from XLOOKUP support. Keep VLOOKUP or use =INDEX($C$2:$C$5,MATCH(F2,$A$2:$A$5,0)) for an exact-match alternative where required. A values-only copy can serve a final report, but it no longer updates when someone enters another code. Preserve the working calculation file separately.