VBA & Macro Problems

How to Add a Custom LAMBDA Function to an Excel Add-In

Nimra MalikNimra Malik Nov 10, 2026 868 views

Question details

The user wants to make a custom LAMBDA or LET formula available globally across all Excel workbooks by saving it in an add-in or custom Ribbon, rather than keeping it restricted to a single workbook.

How to Add a Custom LAMBDA Function to an Excel Add-In
Product
Microsoft Excel
Device & OS
not provided
Scenario
Creating reusable custom functions using LAMBDA and the Name Manager to optimize spreadsheet workflows.
Observed behavior
The goal is to call the custom function from any open workbook without needing to redefine it in the local Name Manager.
Before you start

Ensure the Developer tab is enabled in your Excel ribbon, as you will need access to the Visual Basic Editor (VBE) to define the function globally in your Personal Macro Workbook.

Solution 1Recommended

Add the LAMBDA Function to the Personal Macro Workbook

Save the function in your PERSONAL.XLSB file so it automatically loads in the background every time you open Excel, allowing global access.

By using the Visual Basic Editor's Immediate window, you can programmatically add a named LAMBDA function to your personal macro workbook. This makes it permanently accessible to any other workbook you open.

1
Open the Visual Basic Editor

Press ALT + F11 to launch the Visual Basic Editor in Excel.

2
Access the Immediate Window

If the Immediate window is not visible at the bottom of the editor, press CTRL + G to display it.

3
Execute the Code

Type the following command into the Immediate window and press Enter: Workbooks("personal.xlsb").Names.Add Name:="Split_Char", RefersTo:="=LAMBDA(a,MID(a,SEQUENCE(,LEN(a)),1))"

4
Use the Function

Return to any open Excel workbook. You can now call the custom function by referencing the source workbook: =PERSONAL.XLSB!Split_Char(A1)

Add the LAMBDA Function to the Personal Macro Workbook
Creating a PERSONAL.XLSB file: If you receive a 'Subscript out of range' error, you likely do not have a personal.xlsb file yet. You can generate one by recording a simple dummy macro and selecting 'Personal Macro Workbook' in the 'Store macro in' dropdown menu.
Free Microsoft Office alternative

Use WPS Office for Powerful Spreadsheet Management

If you are struggling with complex macro setups or expensive Office subscriptions, try WPS Office. It provides a free, highly compatible alternative to Microsoft Excel with built-in support for advanced formulas, macros, and seamless multi-workbook management.

Fully compatible with Microsoft Excel file formats (.xlsx, .xlsm, .xlsb, .xlam).Robust built-in support for advanced data analysis and VBA macros.Free, lightweight, and ensures smooth performance on Windows, Mac, and Linux.Familiar tabbed interface allows seamless migration with zero learning curve.
microsoft office alternative - wps office

Frequently Asked Questions

How do I make an Excel LAMBDA function available to all workbooks?

To make a LAMBDA function globally available, save it in your Personal Macro Workbook (PERSONAL.XLSB) or a custom Excel Add-in (.xlam). You can define the name and formula using the VBA Immediate window so it resides permanently in those global files.

Why do I need the PERSONAL.XLSB prefix when calling my custom function?

Because the function is stored in a separate, hidden workbook (PERSONAL.XLSB), Excel requires you to specify the parent workbook's name before the function name. This is why you must type =PERSONAL.XLSB!YourFunction() instead of just =YourFunction().

Can I share my custom LAMBDA functions with other users?

Yes. To share global custom functions, you should save them in an Excel Add-in file (.xlam) rather than your personal macro workbook. Distribute this .xlam file to other users so they can install it via File > Options > Add-ins.

What is the syntax to create a named LAMBDA via VBA?

You use the Names.Add method applied to a specific workbook. The standard syntax is: Workbooks("YourWorkbookName.xlsx").Names.Add Name:="YourFunctionName", RefersTo:="=LAMBDA(variables, calculation)".