Advanced Formula Environment

Mynda Treacy

December 15, 2022

The Advanced Formula Environment (AFE) is part of the Excel Labs add-in and is still in its early stages of development, but it’s already very useful, particularly if you’re scared to write your own LAMBDA functions, it can write them for you, as you’ll see!

You may have seen me use it a few times in tutorials lately, but recently it has undergone an update with some notable improvements, so I’m going to cover it in more detail in this tutorial.

You can get the free Excel Labs add-in from the Office store or via the Insert tab > Get Add-ins, and it’s compatible with Excel 2019 for Desktop onward, as well as Excel for Web and Mac. Once installed, it’ll be available on the Home tab of the ribbon on the far right:

install Excel Labs

It opens in a task pane, which you can detach and resize. Select the Advanced Formula Environment from the list.

Note: as this tool is still in development, the features and interface you see in this tutorial may be different by the time you come to use it.

Watch the Video

At the time of recording the video below, Excel Labs was called the Advanced Formula Environment. While the name has changed to Excel Labs, the functionality shown in the video is still the same.

Subscribe YouTube


Download Workbook

Enter your email address below to download the sample workbook.

By submitting your email address you agree that we can email you our Excel newsletter.

Excel Labs Advanced Formula Environment Features

The Advanced Formula Environment is split into three main sections: Grid, Names and Modules.

Grid: the grid tab enables you to enter formulas in cells, much like typing a formula in the formula bar, except it automatically wraps the formula onto separate rows for each component and applies colour coding.

Excel Advanced Formula Environmentgrid

Names: The names tab is similar to the Name Manager for defined names. The first section contains Functions you write yourself i.e. LAMBDAs:

Excel Advanced Formula Environmentnames

You can also author new LAMBDAs from here by clicking the + symbol shown below:

writing lambda functions in Excel Advanced Formula Environment

Then enter the formula. Note: here you do not need to wrap the formula in LAMBDA, simply enter your formula in the Function Definition field and click Done:

lambda function details in Excel Advanced Formula Environment

When you view the formula in the Name Manager, you’ll see it has written the LAMBDA for you:

lambda functions shown in excel name manager

You can also reference named constants in the Advanced Formula Environment. These appear in the Names section under Formulas and are available in the IntelliSense. For example, I have a defined name for the VAT rate called VATRate, and I can reference this in my NetVAT formula:

referencing named constants in Advanced Formula Environment

This way should the VAT rate ever change, I only need to edit the defined name VATRate and it will feed through to any functions and formulas using it.

Another option is to generate LAMBDAs from formulas in the grid. You can convert calculations split into steps across several cells into a single LAMBDA. Select the cell containing the final result and then click the icon second from the end:

generate lambda function from formulas in the grid in Advanced Formula Environment

Then enter the range (these are the cells containing the intermediate formulas), the parameters (these are the other cells being referenced by the formula), and the output cell (this is the cell containing the formula):

entering the range, cells and output for a lambda function in Advanced Formula Environment

Tip: if the range containing the formulas isn’t contiguous, you can enter the cell references separated by a comma.

Click Preview to see the LAMBDA Excel has written for you (image below). It makes some assumptions about the parameter names, which you can change here.

Tip: select one instance of the name and press F2 to rename all instances:

preview lambda function written in Advanced Formula Environment

Before clicking Create, you can rename the Function if you wish.

It should save automatically and be available in the name manager and grid, but if it doesn’t appear, you can click Save again. This will save it in the Name Manager and you can now use the function in the grid.

Ranges: The ranges area lists any named ranges in the file, however it currently doesn’t include Tables and it cannot display defined names that reference dynamic arrays.

the ranges tab of the names section in Advanced Formula Environment

Formulas: The formulas tab contains formulas you write and define with a name:

the formulas tab of the names section in Advanced Formula Environment

Modules: The Modules tab is used to store collections of named formulas defined using Gist code files from GitHub (cloud icon) or imported from the grid (spreadsheet icon).

the modules tab in Advanced Formula Environment

You can try it out with the Gist file available at this URL: https://gist.github.com/jack-williams/5859d170fcb363dad1620c4d40770527

They can be added to the Workbook module (see image above), or you can create a new module (see image below).

create new module in Advanced Formula Environment

Both are available within the workbook and appear in function auto-complete. Functions in the Workbook module appear in the intellisense list as is, whereas functions added to a new module are prefixed by the function name, separated by a dot operator

new function showing in intellisense

Formula Portability

Formulas saved in the Advanced Formula Environment are also in the Name Manager of the file. If you share the file with someone else, then they will have access to those functions in the file, just the same as any other defined names.

AUTHOR Mynda Treacy Co-Founder / Owner at My Online Training Hub

CIMA qualified Accountant with over 25 years experience in roles such as Global IT Financial Controller for investment banking firms Barclays Capital and NatWest Markets.

Mynda has been awarded Microsoft MVP status every year since 2014 for her expertise and contributions to educating people about Microsoft Excel.

Mynda teaches several courses here at MOTH including Excel Expert, Excel Dashboards, Power BI, Power Query and Power Pivot.

6 thoughts on “Advanced Formula Environment”

  1. Very Nice “Excel 2023”!

    Some Proofing & Update Remarks:

    1. “the parameters (these are the OTHER cells being referenced by the formula),”
    I was a bit confused, at first, so I suggest adding the word: “other”.

    2. “whereas functions added to a new module are prefixed by the function name, separated by a dot operator”
    It is not “function name” – It is “module name” (prefix).

    3. “The AFE will eventually support full formula localisation, …”
    GitHub’s Project Page implies it already has full support (by omission of limitations):
    “AFE supports formula localisation, …”

    Reply
    • Thanks Oz.
      1. done
      2. they are custom functions, not modules.
      3. maybe this has been updated since I wrote this post.

      Reply
  2. Hi Mynda – your instructions for accessing the Advanced Formula Environment is via the Home tab on the ribbon – in my case it is via the Formula tab !!!!

    Reply

Leave a Comment

Current ye@r *