DEV Community

longtermswiv
longtermswiv

Posted on

I timed a spreadsheet formula column from 100 to 10,000 rows. It isn't slow — it's rented.

Every article about "formulas vs Power Query" argues from vibes. I wanted a stopwatch.

So I built the same job twice — a rebate column that has to keep working as orders keep arriving — and timed the formula version at six sizes, from 100 rows to 10,000. Same seeded dataset every run, so the numbers are reproducible instead of anecdotal.

The result is not what the usual advice predicts. The formula column is not slow. It is rented.

The job

An order table on one sheet. A customer→rebate table on another. The formula build adds a Rebate column and fills every row with:

=XLOOKUP(B2,Tiers!$A$2:$A$31,Tiers!$C$2:$C$31,0)
Enter fullscreen mode Exit fullscreen mode

One live formula per row. That is what 95% of real workbooks do, and it is the only place where the formula approach pays a cost per new row.

The measurement

Engine: HyperFormula 3.5, the same library that renders the live grids on the site where this data lives. Each formula is written into a cell and read back, so evaluation is inside the timer — not just string insertion.

Rows Formula cells Total Per row
100 100 9.93 ms 99.26 µs
500 500 19.37 ms 38.74 µs
1,000 1,000 20.69 ms 20.69 µs
2,000 2,000 39.35 ms 19.67 µs
5,000 5,000 86.67 ms 17.33 µs
10,000 10,000 173.54 ms 17.35 µs

Look at the last column, not the third. The per-row figure falls from 99 µs to 17.35 µs as the fixed startup cost gets amortised — and then it stops falling. That floor is the real price of one more order. It does not improve with scale, better hardware, or a newer Excel.

Extend that floor linearly and 100,000 rows lands at roughly 1.7 seconds of engine work per full recalculation. That number is an extension, not a measurement, and I labelled it as such in the table on the page. The transferable fact is the shape: a flat per-row charge with no expiry date. That is a very different thing from "a slow formula".

A piece of advice I could not reproduce

The most repeated piece of spreadsheet advice is that whole-column references like SUMIFS(D:D,B:B,A2) are slow, and you should always write exact ranges.

I ran it both ways, five times per size, took the median:

Rows Exact range Whole column Ratio
500 0.49 ms 0.49 ms 1.01×
2,000 0.97 ms 2.28 ms 2.36×
5,000 2.05 ms 2.05 ms 1.00×

Identical results in every run. At 5,000 rows the difference vanished entirely. The engine stores sparse data, so an empty tail costs almost nothing to skip.

I'm not saying exact ranges are pointless — they are self-documenting, they survive someone inserting a total row at the bottom, and they behave predictably in Excel's own dependency tracker. But if you are hunting for the reason a workbook feels slow, this is not where the milliseconds went. They went into the per-row formula count, which is the first table.

The thing I did not measure, and why

Power Query cannot run inside a browser spreadsheet engine. So I did not time it. Its side of the comparison records structural facts — where the logic lives, where an error points to, what a refresh costs — and zero milliseconds.

Any page showing you "Power Query: 240 ms" measured in a browser is showing you a number it did not produce. A fabricated millisecond is worse than an absent one, because it is the only kind of error you cannot detect by re-running the test.

What actually changes your decision

Not speed. Ownership shape.

The formula column is faster to build. Power Query is faster to keep. Those are the only two speed claims this data supports. Everything else is about what you inherit six months later:

  • formulas spread the logic across N cells; a query keeps it in one Applied Steps list
  • a broken formula is #N/A in one cell among thousands; a broken query names the step
  • the formula column re-evaluates on every recalc; the query re-runs on refresh

And there are four cases where the formula column wins outright: under ~2,000 rows that will never grow, files that must work in Google Sheets, workbooks a Mac user has to maintain, and one-off analyses that get archived on Friday.

Full write-up with the reproducible dataset schema, the engine scope, and the migration steps:

→ Excel formulas vs Power Query: what 10,000 rows actually costs

If you want the function-level version of the same benchmark (VLOOKUP vs XLOOKUP vs INDEX/MATCH at 100,000 rows), that lives here: XLOOKUP measured against VLOOKUP and INDEX-MATCH.

If you re-run this on your own machine and get a different multiplier, I want to know — the multiplier is engine-specific and I said so, but the direction is the part worth arguing about.

Top comments (0)