A short post on using lambdas in excel
Formulas have never looked so clean
This is a short post about how to use =LAMBDA() in excel, and why you might want to.
First, what is a lambda? Wikipedia says:
“In computer programming, an anonymous function (function literal, lambda abstraction, lambda function, lambda expression or block) is a function definition that is not bound to an identifier.”
If that doesn’t speak to you, you’re not alone! But fear not, a lack of formal education in computer science does not detract from the usefulness of the lambda.
The signature of an excel lambda looks like this:
It expects one or more parameters, and then one or more calculations using those parameters. By using the Name Manager, and an anonomous parameter, we can define useful functions that we can reuse in other calculations.
An example that I’ve used extensively is to create a lambda called Ab() and db() which I use to look up the area (Ab) or diameter (db) of a reinforcing bar. Lots of formulas require this functionality, and it used to be done with an ugly VLOOKUP or XLOOKUP function that clutterd up the formula line. Now that formula can be presented much cleaner as shown in the comparison below.
Any time you are performing repetitive LOOKUP operations, consider using a Lambda instead. It helps with readability, reuseability, and debugging excel formulas.