November 17th 2022 Update
The advanced formula environment has been updated to version 1.1. See the change log for more information.
We are excited to announce that LAMBDA and LAMBDA helper functions are now generally available to anyone using Production: Current Channel builds of Excel. In conjunction with LAMBDA going to production, we are also announcing the release of a new add-in, the advanced formula environment, sponsored by the Microsoft Garage and Microsoft Research, which allows easy import/export and authoring of named LAMBDAs.
Thanks to all of our Insiders for using the LAMBDA functions and giving us feedback! As a result we've also made a few changes that we'll outline below in addition to talking about the advanced formula authoring environment, a Microsoft Garage project.
Let’s start with a quick example.
A task I regularly encounter is replacing certain values in a dataset, such as errors or blanks cells. Excel provides IFERROR to replace error values, but there is no function to replace blank cells. Fortunately, with LAMBDA, we can define our own function, IFBLANK.
Instead of authoring this in the grid and then importing to the name manager, I will instead author this in the new formula environment and then sync it to the workbook to make use of it in the grid.
In today’s scenario I am trying to create a quick count of the meals that have been requested for a dinner party I am hosting.
Without IFBLANK, Excel, by default returns a blank which gets coerced to 0 when placed in the cell. I could work around this but I also need to get a count of orders which I will do using MAP and REDUCE to author one formula so I can get updated counts as I continue to get more responses from guests.
Here’s the formula I used for the counts:
=MAP(D4#, LAMBDA(meal, REDUCE(0, IFBLANK(Table14[Meal Preference], B1), LAMBDA(meal_count, preference, IF(meal=preference, meal_count+1, meal_count)))))
Lets go over some improvements and changes we have made on our journey through Insiders to the LAMBDA feature in general.
We have added support for function tooltips for named LAMBDAs in addition to auto-completing the open parentheses character when calling these functions. In other words, calling a function defined using a LAMBDA is exactly the same as calling a native function.
Recursion limit increase
We have upped the limit of recursion by 16 times its original limit. In this example, the text string is 3200 characters long and would have previously returned a #NUM when called with a LAMBDA that recursively reverses a text string.
LAMBDA helper function outputs
We changed the way that the LAMBDA helper functions handle arrays of references.
Previously when a LAMBDA helper function returned an array and the associated LAMBDA returns a single cell, a #CALC error would be returned. We have changed this to automatically return the cell value as the output of the LAMBDA function.
In this example, Excel would have returned a #CALC but now will return the results.
Today we are introducing a new tool to aid in the authoring of more complex named formulas. The advanced formula environment is a space where we are hoping to experiment and explore new and different methods for authoring formulas with special functionality designed with LAMBDAs and LET in mind.
Key features of the new tool:
The environment is available on all platforms where Office Add-ins are available (Mac, Windows, Web)
Let's take a look at some of the functionality so you can get started with managing and editing your new and pre-existing named functions!
There are two major views contained within the advanced formula environment, Manager and Editor.
The Manager is where you will see all of your names with their own individual cards and associated quick actions. Much like the Name Manager but with more functionality.
|Edit the name|
|Rename the formula|
|Delete the entry|
|Export the definition for sharing|
The Editor is where you can go to edit all entries within the workbook or create new namespaces for collections of formulas.
This is where I usually go when I want to dive in to create more complex functions as you get the full version of the editor in this view and can create multiple names sequentially.
The workbook section contains all names which are not attached to a given sheet but instead are saved globally in the workbook.
Some of my favorite pieces of functionality are the ability to easily add new lines, tabulate sections of the formula while also being able to comment out pieces of my formula that I might be working on, or collapse definitions so I can more easily dig into specific areas. Not to mention, if I change my mind later, I can easily undo/redo any changes I am actively working on.
Here's another example I made for a chess game I have been building for fun in Excel.
The advanced formula environment can import definitions into the manager. You can important individual definitions as well as libraries of definitions via text or through GitHub Gists.
The main entry point for importing can be found by selecting the action in the actions bar. The main entry point defaults to “From URL” but the dropdown reveals the “From text” option.
If you’d like to try out this functionality yourself I am including a gist with some of the examples I created today on top of additional LAMBDAs I have used in prior posts. I think this is a better way to share than having you copy/paste from a blog post, so lets be the first to try it out!
aka.ms/LAMBDAGist (make sure to use the URL you are redirected to as the add-in doesn't let you use non gist paths)
We look forward to the libraries of LAMBDAs the community produces and hearing from you all about what does and doesn’t work in this new environment we have created.
We are actively looking for feedback on the experience and would invite you to provide feedback either through techcommunity or by going to this github repository.
To get access to LAMBDA functions, please make sure you have updated to the latest version of Excel. Specifically versions greater than or equal to:
You can use this link or manually install if from the app
To access the advanced formula environment, simply search for the “advanced formula environment” within the built-in add-ins store of Excel and install it like any other Office add-in.
Once the add-in is installed, you should be able to find it on your home tab. The ribbon button looks like the picture below.
To learn more about LAMBDA and the advanced formula environment, please check out the links below and in the meantime we are excited to hear more about the ways you have used LAMBDA in your own workbooks!
LAMBDA is now available to Office 365 Subscribers in Production: Current Channel
Do you have an idea to make Excel better? We'd love to hear about it. Go to the Excel forum in Microsoft Feedback to submit your idea or vote for other ideas. You can also click the Feedback button in Excel and choose "I have a suggestion".
The last thing I would like to mention is that all of this was done as a joint collaboration between Microsoft Research and Excel Engineering. It’s been a blast building out all the experiences you see today and it wouldn’t have been possible without the brilliant researchers at Microsoft Research Cambridge.
Program Manager, Excel
Lead Developer and Researcher, Microsoft Research Cambridge
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.