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
solver=LAMBDA(grid, | |
LET( | |
numbers, SEQUENCE(9), | |
numgrid, SEQUENCE(9,9,0), | |
vgrid, TOCOL(grid*1), | |
pos, XMATCH(0,vgrid)-1, | |
IF( | |
ISNA(pos), grid, | |
LET( | |
i,INT(pos/9), |
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
/* | |
array is a column of stuff to which we want to apply element function | |
row_function is some function that produces an array with a fixed number of columns | |
the column count produced by row_function must be identical regardless of input | |
stack_function is one of V or H | |
If you're unsure how these work or why we would use them, please review these videos: | |
https://youtu.be/04jOeiMypXw | |
https://youtu.be/wEBLT9QfQRw |
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
/* | |
Credit: Peter Bartholemew | |
https://www.linkedin.com/in/peterbartholomew/ | |
https://techcommunity.microsoft.com/t5/user/viewprofilepage/user-id/214174#profile | |
--- | |
BMAPλ | |
Recursively bisects an array and applies a function to the leaf nodes. |
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
/* | |
GROUPAGGREGATE | |
Creates summary tables of data similar to SQL's GROUP BY queries | |
Inputs | |
- dat: a range or array of data with at least two columns, | |
one of which's control value must be "group" and one not "group" | |
- control: a single-row array, where COLUMNS(control)=COLUMNS(dat), of values from this list: | |
group - the values in this column will be output as row headers |
NewerOlder