This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IFOMITTED = LAMBDA(arg,then,IF(ISOMITTED(arg),then,arg)); | |
SUMPRODUCT2 = LAMBDA(array, [axis], | |
SUM(IF(IFOMITTED(axis,0)=0, BYROW, BYCOL)(array, PRODUCT)) | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LIST.ALLPAIRS = LAMBDA(list1, list2, | |
LET( | |
list1Col, TOCOL(list1), | |
list2Col, TOCOL(list2), | |
list1length, ROWS(list1Col), | |
list2length, ROWS(list2Col), | |
resultRows, SEQUENCE(list1length * list2length, 1), | |
rowIndex1, CEILING(resultRows / list2length, 1), | |
rowIndex2, MOD(resultRows - 1, list2length) + 1, | |
HSTACK(INDEX(list1Col, rowIndex1), INDEX(list2Col, rowIndex2)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Spread an array of arguments across the parameters of a function of up to five parameters | |
SPREAD = LAMBDA(function, LAMBDA(arg_array, | |
LET( | |
arg_vector, TOCOL(arg_array), | |
CHOOSE( | |
ROWS(arg_vector), | |
function(INDEX(arg_vector,1)), | |
function(INDEX(arg_vector,1), INDEX(arg_vector, 2)), | |
function(INDEX(arg_vector,1), INDEX(arg_vector, 2), INDEX(arg_vector, 3)), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IFOMITTED = LAMBDA(arg, then, IF(ISOMITTED(arg), then, arg)); | |
// Functions for common mathematical operators | |
MULTIPLY = LAMBDA(x, y, x*y); | |
ADD = LAMBDA(x, y, x+y); | |
SUBTRACT = LAMBDA(x, y, x-y); | |
DIVIDE = LAMBDA(x, y, x/y); | |
// Apply a series of functions to an array | |
PIPE =LAMBDA(array, functions, operator, [init], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IFOMITTED = LAMBDA(arg, then, IF(ISOMITTED(arg), then, arg)); | |
BINARYSEARCH = LAMBDA(search_for, array, [stop], [iter], [left_index], [right_index], | |
LET( | |
_iter, IFOMITTED(iter, 1), | |
_stop, IFOMITTED(stop, ROWS(array)+1), | |
_left_index, IFOMITTED(left_index, 1), | |
_right_index, IFOMITTED(right_index, ROWS(array)), | |
_seq, SEQUENCE(ROWS(array)), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
GETBIGRAMS - Get the bigrams of a text string | |
Inputs: 1. str - a text string | |
Returns: A vertical array of the bigrams of the text string | |
Example: | |
=GETBIGRAMS("banana") | |
={"ba";"an";"na";"a"} | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function main(workbook: ExcelScript.Workbook) { | |
const activeSheet = workbook.getActiveWorksheet() | |
// Returns an object representing the worksheet's protection | |
const activeSheetProtection = activeSheet.getProtection() | |
// Protect the sheet according to preferred options (password as 2nd arg is optional) | |
// This line uses the ternary operator. The protect call is only used if the getProtected() call returns false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Create and format a chart from some AdventureWorksDW2019 data | |
* The table has these columns: Year, Month, SalesAmount | |
* The worksheet must include a named cell called 'referenceLineValue'. This value is used to draw the line on the chart. | |
*/ | |
function main(workbook: ExcelScript.Workbook) { | |
let selectedSheet = workbook.getActiveWorksheet(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let | |
Source = "APS Deposit 04/01/2022 $5,174.27 APS ACH Deposit 04/04/2022 $65,186.66", | |
Split = Text.Split(Source, " "), | |
Typed = List.Transform(Split, | |
each try Number.From(_) otherwise | |
try Date.From(_, "en-gb") otherwise _ ), | |
Accumulate = List.Accumulate({0..List.Count(Typed)-1}, "", | |
(a, b) => | |
let | |
c = Typed{b}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
two_arg = LAMBDA(function, | |
LAMBDA(x, y, | |
function(x, y) | |
) | |
); |
NewerOlder