3.5.12.7 Let


Description

Minimum Origin Version Required: 2021

Similar to MS Excel's LET() function. Assign values to variables, for up to 39 variable-value pairs, for use in expression. Optional $ is used is used when returning strings.

Syntax

LET(name1,value1[,name2,value2,]...[,name39, value39], expression)[$]

Parameters

name1 ... name39

the variable name paired with values var1 through var39

value1 ... value39

the value(s) paired with name1 through name39

expression

expression to be evaluated using value1 ... value39

$

use $ when returning a string

Return

Return the result of expression.

Example

newbook; //start a new workbook
wks.nCols = 3; //set number of columns to 3
patternT irng:=1 text:="A B C" mode:=random; //fill 1st column with random A, B and C
patternT irng:=2 text:="A B C" mode:=random; //fill 2nd column with random A, B and C
//set column C value as 500 if column A&B have same value, otherwise set C as missing value
//The LET() function assigns if() function result to t and calculate t*500
csetvalue col:=col(C) formula:="LET(t,if(A$==B$,1,0/0),t*500)";

See Also