Questions tagged [excel-lambda]

Used for questions related to custom lambda functions in Excel.

Custom functions in Excel used to be written using VBA or JavaScript. Since the introduction of LAMBDA it's possible to define custom functions using Excel’s formula language. They don't require enabling macros.

Syntax:
=LAMBDA([parameter1, parameter2, …,] calculation)
parameter. A value to pass to the function, e.g. a cell reference, string or number. Accepts up to 253 parameters. This argument is optional.
calculation. The formula to execute and return as the result. It must be the last argument and it must return a result. This argument is required.

If used as an example in a cell, it can be put like this:
=LAMBDA(x,x^2)(5)
5 is the number which is passed to the function. It takes the place of x, in the calculation x^2. So, the actual calculation in this case is 5^2. It gives the result of 25.

To be able to reuse lambda functions they must be put into Excel's Name Manager. Using the previous example, =LAMBDA(x,x^2) should be put in the Refers to: section and some name should be provided in the Name: section (e.g., SQUARE). Then this function will become available in the workbook by its name =SQUARE().

58 questions
13
votes
5 answers

Generate All Permutations in Excel using LAMBDA

This is a frequently asked and answered question: how can I generate all permutations in Excel: 2011 2016 2017 2017 superuser 2018 2021 and now in 2022 which did not get an answer before it was closed as a duplicate, which is unfortunate because…
mark fitzpatrick
  • 3,162
  • 2
  • 11
  • 23
8
votes
1 answer

Excel's LAMBDA with a "kind of" composite function

Ever since I learnt that Excel is now Turing-complete, I understood that I can now "program" Excel using exclusively formulas, therefore excluding any use of VBA whatsoever. I do not know if my conclusion is right or wrong. In reality, I do not…
vsoler
  • 1,027
  • 2
  • 8
  • 17
8
votes
1 answer

Excel - How can we replace multiple characters or whole words in a cell using LAMBDA()

At risk of being off-topic I decided to do a little Q&A as I'm pretty excited about a new function MS is introducing to Excel365; the LAMBDA() function. If the general opinion is such that this is off-topic, please let me know and I can take down…
JvdV
  • 70,606
  • 8
  • 39
  • 70
4
votes
1 answer

TEXTSPLIT combined with BYROW returns an unexpected result when using an array of strings as input

I am testing the following simple case: =LET(input, {"a,b;c,d;" ; "e,d;f,g;"}, BYROW(input, LAMBDA(item, TEXTJOIN(";",,TEXTSPLIT(item,",",";", TRUE))))) since the TEXTJOIN is the inverse operation of TEXTSPLIT, the output should be the same as…
David Leal
  • 6,373
  • 4
  • 29
  • 56
4
votes
2 answers

Recursive LAMBDA to replace characters by specific substitutes from a lookup table

The goal is to iterate through rows of the character table and replace each character with it's substitute. The character table in this example is ={"&","&";"<","<";">",">";"'","'";"""","""}, or: *(Sidenote: "&","&" must be…
Filcuk
  • 154
  • 18
3
votes
2 answers

Calculate orders with all lines available after prior orders

I have the following data: order part cat qty available qty ordered priority aa a 1 4 2 2 aa a 2 2 3 2 bb b 1 3 3 3 bb a 1 4 3 3 cc a 2 2 1 1 cc a 1 4 2 1 With this data I'd like to calculate the which orders have enough…
P.b
  • 8,293
  • 2
  • 10
  • 25
3
votes
2 answers

Define a lambda function with infinite number of arguments

Some Excel native functions like VSTACK permit of infinite number of arguments, and they have an intellisense as follows: I would like to know how to define such a function by LAMBDA. I tried try = LAMBDA(array1, [array2], [array3], [array4], 123)…
SoftTimur
  • 5,630
  • 38
  • 140
  • 292
3
votes
1 answer

How to share generic LAMBDA-functions over different projects?

Given a generic LAMBDA-UNION-function like this: https://stackoverflow.com/a/69861437/16578424: What would be the best method to reuse it in several projects?
Ike
  • 9,580
  • 4
  • 13
  • 29
3
votes
1 answer

Remove all numbers from a string using LAMBDA recursive function

I've been following the guide on Exceljet for how to create a recursive LAMBDA function that removes all numbers from a string. For example, A1B2C3D4E5 becomes ABCDE. The only thing I wanted differently was to have the string containing the…
Statto
  • 410
  • 3
  • 9
3
votes
1 answer

Add Together a Set of Numbers using LAMBDA Recursion in Excel

I have a continuous set of numbers in cell I32 (123456789) of my worksheet. I want to use the new LAMBDA function to add each number with nine iterations (using recursion). The final value in cell L32 should be 45. What I've got at the moment…
Statto
  • 410
  • 3
  • 9
3
votes
3 answers

Capitalize only the first letter with LAMBDA in Excel

In order to capitalize only the first letter of a text I used =UPPER(LEFT(A1,1)) & LOWER(RIGHT(A1,LEN(A1)-1)) With the introduction of LAMBDA function in Excel, how can I create a custom lambda function out of it?
ZygD
  • 22,092
  • 39
  • 79
  • 102
2
votes
3 answers

Understanding Excel lambda

I am trying to understand better how does the recursivity works in Excel using the Lambda function. I didn't manage to wrap my head around how to increment the "value" the function is at. The idea here is to stack all the unique "Invoices" value…
Enzo_c
  • 23
  • 2
2
votes
2 answers

Excel - Working with incremental numbers, series (summing, finding values, etc)

Context / Example I am working with some datasets that have incrementing numbers¹. For example, I mean where the cost of an upgrade gets more and more expensive for each level you go…
Martin
  • 280
  • 1
  • 10
2
votes
0 answers

Adding a LAMBDA formula forces other users to reopen spreadsheet

Issue: As the title says, any time a LAMBDA formula is used in my spreadsheet it forces all other users who have the shared spreadsheet open to reopen the spreadsheet. With my brain's limited capacity, I am struggling to find anyone else struggling…
jeranon
  • 433
  • 2
  • 14
2
votes
2 answers

Repeat values n times where n could also be 0.5

I saw the following question on here regarding repeating values: List number of lessons including half lessons based on Number of lessons and lesson name This question needed an older Excel version, I liked the problem statement and liked searching…
P.b
  • 8,293
  • 2
  • 10
  • 25
1
2 3 4