DEV Community

longtermswiv
longtermswiv

Posted on Originally published at formulalab.dev

I benchmarked VLOOKUP vs XLOOKUP vs INDEX/MATCH in a JavaScript spreadsheet engine. The winner surprised me.

Every "VLOOKUP vs XLOOKUP" article tells you the same thing: XLOOKUP is newer, cleaner, and faster. I wanted to see actual numbers instead of vibes, so I ran a controlled benchmark inside HyperFormula, the open-source formula engine that powers a lot of web-based spreadsheets.

The result inverted the usual advice. VLOOKUP was the fastest of the three at every data size I tested, and INDEX/MATCH — the "pro" choice — was the slowest.

Here is the data, exactly how I measured it, and the one caveat that keeps this from being a blanket recommendation.

The setup

  • Engine: HyperFormula 3.3.1 (GPL-3.0, used here for benchmarking only)
  • Runtime: Node v24.22.3, darwin arm64 (Apple Silicon)
  • Date: 2026-11-14
  • Sheet: a lookup table A1:B{N} where the key is 1..N and the value is key * 10. Column D holds M lookup formulas, each referencing the full column.
  • Measurement: time a batch setCellContents that triggers a full recalculation. Take the median of several runs. Verify correctness by checking that the sum of all results equals sum(1..M) * 10 — so a fast-but-wrong engine cannot win.

Three formulas, same job (find the value for a key):

=VLOOKUP(key, A:B, 2, FALSE)
=INDEX(B:B, MATCH(key, A:A, 0))
=XLOOKUP(key, A:A, B:B)
Enter fullscreen mode Exit fullscreen mode

The numbers

Median milliseconds for a full recalc, all results verified correct:

Rows (N) Lookups (M) VLOOKUP XLOOKUP INDEX/MATCH
1,000 200 17.6 23.7 29.0
10,000 500 293.6 408.5 536.1
50,000 500 2,367 3,323 4,184
100,000 1,000 10,870 15,046 18,030

At 50,000 rows, VLOOKUP finished in ~2.4s while INDEX/MATCH took ~4.2s — roughly 1.8× slower for the identical result. XLOOKUP sat in the middle every time.

Why VLOOKUP wins here

This is an implementation detail of the engine, not a law of spreadsheets:

  1. VLOOKUP has a dedicated, heavily optimized code path. It is the most-used lookup function, so engines tend to tune it first. In HyperFormula it evaluates as a single operation with an efficient column scan.
  2. INDEX/MATCH is two functions. MATCH finds the position, INDEX fetches the value. That is two evaluation passes and an intermediate result, which adds overhead per formula — multiplied across hundreds of lookups.
  3. XLOOKUP is newer and more general (it handles left-lookups, defaults, and search modes). Generality costs a little; it does more work per call than the narrow VLOOKUP path.

The gap widens with row count because the per-lookup overhead is paid M times against an N-row scan.

The caveat that matters

This is HyperFormula's JavaScript engine, not Excel's native calculation engine. Excel is written in optimized native code and has its own lookup caching and smart-recalculation logic. The ranking above is about how a web spreadsheet engine behaves — which is exactly what matters if you are building a spreadsheet-like app, an interactive tutorial, or a formula playground in the browser.

Do not read this as "always use VLOOKUP in Excel." Read it as: the engine matters more than the function's reputation, and you should measure on your actual target.

Try it yourself

I built these measurements into a set of free, editable labs. Each page runs the real engine in your browser — change a cell and watch the result recompute, no signup:

  • VLOOKUP lab — syntax, the FALSE trap, and the benchmark above
  • XLOOKUP lab — left-lookups and default values
  • INDEX and MATCH — the two-step pattern, decomposed

The full benchmark script (bench.mjs) and raw JSON results are published alongside the labs so you can reproduce or dispute the numbers. If your engine ranks them differently, I would genuinely like to see it.

Takeaway

"XLOOKUP is faster" is a claim, not a measurement. In the engine I tested, the old workhorse won, the flexible newcomer came second, and the expert favorite came last. Benchmark on your target, verify correctness, and let the median decide.

Top comments (0)