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
2
votes
2 answers

Makearray function in Office Excel unable to generate proper amount of columns for the array

I am using Office 365 currently and I want to make a visualization tools using MAKEARRAY functions. For example, if I want to display sequential of 32 items, I would display it in this way: I use the following formula of Makearray to generate the…
Alan Koh W.T
  • 413
  • 4
  • 19
2
votes
1 answer

How to write a LAMBDA function in Excel for this recursive calculation

I'm trying to come up with a LAMBDA formula that captures the following recursive calculation: Column A has 40 rows with integers between 1 and 40. Column B divides each integer in column A by 6 and rounds it up. Column C divides each integer in…
STS
  • 21
  • 2
2
votes
1 answer

INDIRECT and OFFSET in the function body make a name special

I would like to write a user-defined function CHOOSERANGE that returns a range from 4 coordinates. The first version is as follows: CHOOSERANGE = LAMBDA(row_min, col_min, row_max, col_max, INDIRECT(ADDRESS(row_min,…
SoftTimur
  • 5,630
  • 38
  • 140
  • 292
2
votes
3 answers

Is it possible to step through a row of data and sum every n-th cell using a Lambda function?

I have a model that produces an array of values that can be several hundred columns wide. Every 25th column contains a number that I need to add to the total. I thought the cleanest solution would be creating a LAMBDA function that would take the…
Blake
  • 23
  • 4
1
vote
1 answer

In Office365 Excel, how to define a named lambda function without using the Name Manager "Refers to" field?

Preferably the lambda function defined in the worksheet. Google Bard said to use the name() function, but there is no such function in Excel. Also tried the "Create from Selection" approach where the name is in cell A1 and the lambda function is…
ciso
  • 2,887
  • 6
  • 33
  • 58
1
vote
2 answers

Using Office365 Excel array formulas, how to vertically stack a variable number of arrays from a single sheet?

Each array is listed horizontally, has n columns and a variable number of rows. Every array has the same n number of columns. There is a blank column between each array. They can be combined using vstack(array1,array2,etc...) but this requires…
ciso
  • 2,887
  • 6
  • 33
  • 58
1
vote
0 answers

Calling Excel Add-In functions from within MAP or MAKEARRAY

Using Office365 desktop I'm trying to call add-in functions from within either MAP or MAKEARRAY so it can spill alongside an existing spill. I don't know how many rows will be in the spill, so being dynamic is somewhat of a requirement. I've tried a…
1
vote
1 answer

Extended: How to adjust this LAMBDA Excel formula to result multiple columns of price data?

In relation to my last question at How can I fix this Excel LAMBDA formula to result all SKUs and prices, type of Unpivot formula @Ike created this LAMBDA which worked perfectly for the 3 columns of normal price data, now the next step I have to…
1
vote
1 answer

How can I fix this Excel LAMBDA formula to result all SKUs and prices, type of Unpivot formula

I'm trying to make a formula which will unpivot some price data, there would several extra columns of data later, including some SKU data, and then 3 columns of price, 3 columns of net price, and the discount amount/unit size for each corresponding…
Andy L
  • 93
  • 6
1
vote
1 answer

Excel: #CALC! error (Nested Array) when using MAP functions for counting interval overlaps

I am struggling with the following formula, it works for some scenarios but not in all of them. The name input has the data set that is failing, getting an #CALC! error with the description "Nested Array": =LET(input,…
David Leal
  • 6,373
  • 4
  • 29
  • 56
1
vote
1 answer

ByCol conditional Lambda

I am using the following function to calculate the sum of specific rows and I'd like to modify it to sum different rows if there's a value in the cell of a specific row as it's traversing the sequence. =LET(duration,…
1
vote
2 answers

Increment numbers when value changes in another column

I currently have a column of letters in B2:B11 alongside numbers that increment by 1 when letters appear consecutively (C2:C11). When a new letter appears, the sequence resets and starts from 1 again. This is the formula I'm…
Statto
  • 410
  • 3
  • 9
1
vote
2 answers

Automatically add a number of row cells and subtract a 3rd row over a variable number of columns in Excel

I have the following function that automatically sums 3 rows together for a specified number of cells determined by D2: =BYCOL((INDEX($1:$11,{4;5;10},SEQUENCE(1,D2,COLUMN(I:I)))),LAMBDA(x,SUM(x))) The values in each column in rows 4 and 5 I wish to…
1
vote
1 answer

Excel function UNIQUE is not working on MAKEARRAY and on RANDARRAY (multi-dimension array)

I have a question about UNIQUE function for random number generation in multi-dimension array. As you can see, I try to generate an array with random and unique numbers of 1->100 inside 5X5 array. I try both MAKEARRAY and RANDARRAY with the UNIQUE…
Alan Koh W.T
  • 413
  • 4
  • 19
1
vote
0 answers

Performance problem with INDEX function and names introduced inside LET/LAMBDA

Excel's INDEX function shows strange behaviour when the object being indexed is a name introduced in a LET construct or a parameter of a LAMBDA. The behaviour is consistent on Windows and Mac. Suppose cell B2 contains the…
JohnB
  • 13,315
  • 4
  • 38
  • 65