Skip to content

Instantly share code, notes, and snippets.

@nsolnit
nsolnit / xlTools.txt
Last active February 7, 2024 17:12
Toolbox of named excel lambdas
/**Cumulative sum over array*/
CSUM = LAMBDA(arr,
SCAN(0,arr,LAMBDA(a,c,a+c)));
/**Ignores Null ref (empty, space or 0), returns "" or VAl if provided*/
IFN = LAMBDA(REF,FUN,[VAL],
IF(OR(REF="",REF=" ",REF=0),IF(ISOMITTED(VAL),"",VAL),FUN)
);
/**1D linear interpolation, set SORTED=0 for unsorted data - presorting data recommended*/
@nsolnit
nsolnit / xInterp.txt
Last active June 15, 2023 10:05
Named EXCEL lambdas for one and two dimensional linear interpolation
/**Basic 1D linear generator from 2 pts*/
LEXT = LAMBDA(X,XS,YS,
LET(X_1,INDEX(XS,1),
X_2, INDEX(XS,2),
Y_1, INDEX(YS,1),
Y_2, INDEX(YS,2),
Y_1+(X-X_1)*(Y_2-Y_1)/(X_2-X_1)
)
);