Tomaz Vajngerl
Write a formula once, give it a name, and call it like any built-in function.
Every spreadsheet user has one formula they keep copying around. A price with tax. A weighted score. A cleanup of messy text. Each copy is a chance to paste it wrong, and each improvement has to be re-pasted everywhere. Collabora Online now has a better answer: LAMBDA, a Calc function that builds new functions.
With LAMBDA you describe a calculation once, in terms of named inputs, and you get back a function value. You can call it on the spot, store it under a name and reuse it across the whole document, pass it to other functions, or return it from them. Functions become ordinary values in your formulas, just like numbers and text.
The basics
A LAMBDA lists its input names first and the formula that uses them last:
=LAMBDA(x, y, x + y)(3, 4)
The (3, 4) at the end calls the freshly built function immediately, so this cell shows 7.
LAMBDA also has its own page in the Function Wizard, with its argument list and a description, so it is as easy to find as any built-in function.
Calling it in place is handy for trying things out, but the real power is naming it. Open the Formulas tab and click Define (in the classic menu, that is Data > Named Ranges and Expressions > Define), and define, say, NETPRICE:
=LAMBDA(gross, gross / 1.2)
From then on every cell in the document can simply write:
=NETPRICE(B2)
The calculation lives in exactly one place. Fix it or refine it there, and every use is updated. In effect you can grow a small library of your own functions inside the document, without writing a single line of macro code.
Functions that take functions
LAMBDA arrives together with a family of helper functions that accept a function as an argument and apply it over data:
– MAP transforms each element of one or more arrays: =MAP(A2:A100, LAMBDA(v, v * 2))
– REDUCE folds an array into a single value: =REDUCE(0, A2:A100, LAMBDA(acc, v, acc + v))
– SCAN is like REDUCE but shows every intermediate result, which gives you running totals in one formula.
– BYROW and BYCOL call a function once per row or per column: =BYROW(A2:C100, LAMBDA(r, SUM(r)))
– MAKEARRAY generates a whole array from a row and column recipe: =MAKEARRAY(10, 10, LAMBDA(r, c, r * c)) builds a multiplication table.
– ISOMITTED, used inside a LAMBDA, tells you whether an optional argument was supplied.
– LET, which names intermediate results within one formula, has been reworked to cooperate with LAMBDA, so a LET name can hold a function: =LET(f, LAMBDA(x, x * x), f(4))
These helpers spill their results as dynamic arrays, so a single MAP over a column fills as many cells as it needs. They also matter for interoperability: spreadsheets that use these functions now load and calculate correctly, and save back faithfully.
Functions are values now
Under the hood this work makes callables first-class objects in the Calc formula engine, and that reaches further than LAMBDA itself. Built-in functions and even Basic macro functions can be passed around the same way:
=LET(f, SUM, f(1, 2, 3))
=IF(A1 > 0, SUM, AVERAGE)(B2:B100)
=MAP(A2:A100, SQRT)
The second example picks which aggregation to run based on a condition, then calls it. No duplicated ranges, no nested copies of the same formula.
LAMBDA supports the full range of what you would expect from real functions. Parameters can be optional, written as [name], and checked with ISOMITTED. A LAMBDA can return another LAMBDA. A LAMBDA can be passed to itself to recurse, and the engine bounds the nesting depth so a runaway recursion ends in an error value instead of trouble.
Interoperability built in
All of this round-trips through both ODF and XLSX files. On the XLSX side, LAMBDA and its helpers map to the _xlfn. function names and _xlpm. parameter names used by other spreadsheet applications, optional parameters arrive with the _xlop. prefix, and built-in functions passed as values with the _xleta. prefix. Documents using named LAMBDA functions defined in another suite open in Collabora Online and just work, and documents you build here save back without loss.
Credits
LAMBDA, ISOMITTED and the higher-order functions BYCOL, BYROW, MAKEARRAY, MAP, REDUCE and SCAN, and the underlying rework that made callables first-class objects in the formula engine, were contributed by Ben Urban. Ben iterated on this from a first proposal in April 2026 to the merged feature, through many rounds of review, and it is a major piece of engineering: new opcodes, a new value type in the interpreter, and a rewritten LET. Thank you, Ben!
Around that contribution, Tomaž Vajngerl reviewed and integrated the series, added the file format import and export pieces and the interoperability test documents, and hardened the callable evaluation; Caolán McNamara fixed crash-testing findings; and Xisco Fauli reviewed the work as it also went into the LibreOffice project’s tree.
This all lands alongside the dynamic array and spilled formula work in the same release, so your own functions and spilling arrays combine naturally.
Try it in Collabora Online 26.04, name your first LAMBDA, and delete a few dozen copied formulas while you are at it.
The commits
For readers who want to follow the work itself, the main changes are public on Gerrit:
– Callables as first-class objects in the formula engine, by Ben Urban: gerrit.libreoffice.org change 206264, Collabora change 5358
– LAMBDA and ISOMITTED, with the reworked LET, by Ben Urban (tdf#138749, tdf#164510): change 206265, Collabora change 5359
– BYCOL, BYROW, MAKEARRAY, MAP, REDUCE and SCAN, by Ben Urban: change 205979, Collabora change 5360
– Optional parameters for LAMBDA, by Ben Urban: change 207392; LAMBDA with no parameters: change 207973
– XLSX import of the _xlop. and _xleta. prefixes, by Tomaž Vajngerl: change 207891, change 207892
– The LAMBDA interoperability test document and its XLSX round-trip, by Tomaž Vajngerl: change 207822, change 207823
– Hardening of the callable evaluation, by Tomaž Vajngerl: change 208345
– The dynamic array work referenced above, by Tomaž Vajngerl: the @ operator (change 206673), dynamic-array masters (change 206674), the # spilled-range operator (change 207904) and its _xlfn.ANCHORARRAY mapping (change 207907), and the ODF round-trip (change 207171)