Excel Lambda Function


Have you ever used VBA in Excel to create your own functions? LAMBDA allows you to create your own functions without using VBA code.

Here is a YouTube video by Leila Gharani called Excel LAMBDA – HOW & WHEN you Should use it.

Here’s a more advanced video on recursive LAMBDA. Leila creates a function that does a search and replace for many search terms and on an entire range all at once. This would be helpful in the data-cleaning process. Excel RECURSIVE Lambda – Create loops with ZERO coding!

Multiply(a,b)

How do you create a custom function that simply multiplies two numbers together? You could use VBA. This example uses a LAMBDA function instead. How do you create this custom function using LAMBDA? In Excel, click on the Formulas tab (menu). Click the Define Name button. Fill in the dialog box as shown below. The LAMBDA function takes the arguments and then the calculation. The calculation is always the last on in the list separated with commas.

Since Excel’s Autocomplete feature supports functions created with LAMBDA, you can type =mul and you will see your function. It’s good to give it a Comment because that will be displayed to the user as a Tooltip as shown below in the screenshot.

Here are two Lambda facts:

  • If you want to use your LAMBDA function in another workbook, copy a formula involving the function and paste it into a cell. It won’t copy over your Comments however.
  • If you want to test the LAMBDA function before creating it, and you should, type the function in a cell followed by values in parentheses as follows: =LAMBDA(a,b,a*b)(2,3). This will return 6.

Leave a comment

Your email address will not be published. Required fields are marked *