Build 4.9.0.16 adds all other lambda functions introduced in Office 365 (reminder : xlsgen supports them, and they are not available in any installable Excel version other than the one associated to an Office 365 subscription).
BYROW() | Applies a Lambda function to each row and returns an array of the results. For example, if the original array is 3 columns by 2 rows, the returned array is 1 column by 2 rows. |
BYCOL() | Applies a Lambda function to each column and returns an array of the results. For example, if the original array is 3 columns by 2 rows, the returned array is 3 columns by 1 row. |
MAKEARRAY() | Returns a calculated array of a specified row and column size, by applying a Lambda function. |
SCAN() | Scans an array by applying a Lambda function to each value and returns an array that has each intermediate value. |
MAP() | Returns an array formed by mapping each value in the array(s) to a new value by applying a Lambda function to create a new value. |
REDUCE() | Reduces an array to an accumulated value by applying a Lambda function to each value and returning the total value in the accumulator. |
ISOMITTED() | Checks whether the value in a Lambda function is missing and returns TRUE or FALSE. |
Those functions basically iterate over the cells in a particular way, either cell by cell, row by row, and so on, and what they do is apply the lambda function on each cell value. The result is either written back to a new cell, with most functions above, or accumulated, as in functions SCAN() and REDUCE().
 Example : =BYROW(A1:C2; LAMBDA(x;MAX(x)) ) |
 Example : =BYCOL(A1:C2; LAMBDA(x;MAX(x)) ) |
 Example : =MAKEARRAY(2; 3; LAMBDA(r; c; r*c) ) |
 Example : =SCAN(""; A1:C2; LAMBDA(t; u; t&u) ). t is an accumulator with an initial value of "". |
 Example : =MAP(A1:C2; LAMBDA(a; IF(a>4;a*a;+a) )) |
 Example : =REDUCE(0; A1:C2; LAMBDA(t; u; IF(u>4; t+u; 0)) ). t is an accumulator with an initial value of 0. |
As for the ISOMITTED() function, it works like this :
C++ code |
xlsgen::IXlsWorksheetPtr worksheet = workbook->WorksheetByIndex[1];
// create a lambda function xlsgen::IXlsDynamicRangePtr dynrange_xy = worksheet->NewDynamicRange(L"MyFuncXY"); dynrange_xy->Formula = L"=LAMBDA(x;y;IF(ISOMITTED(y);\"y param is omitted\";x&y))"; dynrange_xy->UserDefinedFunction = TRUE; dynrange_xy->Description = L"(x,y) function";
worksheet->Formula[10][6] = L"=MyFuncXY(4;2)"; _bstr_t s106 = wksht->Label[10][6]; // returns "42"
worksheet->Formula[11][6] = L"=MyFuncXY(4)"; _bstr_t s116 = wksht->Label[11][6]; // returns "y param is omitted"
|