Tetapkan variabel di dalam rumus
=LET(name1, value1, [name2/value2], ..., result)
| Parameter | Deskripsi |
|---|---|
name1 |
First name to assign. Must begin with a letter. |
value1 |
The value or calculation to assign to name 1. |
name2/value2 |
[optional] Second name and value. Entered as a pair of arguments. |
result |
A calculation or a variable previously calculated. |
Below is the general form of the LET function with one variable:
=LET(x,10,x+1) // returns 11
With a second variable:
=LET(x,10,y,5,x+y) // returns 15
A chief benefit of the LET function is simplification by eliminating redundancy. For example, the screenshot above shows a formula that uses the SEQUE
=LET(dates,SEQUENCE(C5-C4+1,1,C4,1),FILTER(dates,WEEKDAY(dates,2)<6))
The first argument declares the variable dates and the second argument assigns the output from SEQUENCE to dates:
=LET(dates,SEQUENCE(C5-C4+1,1,C4,1)
Notice the start and end dates come from cells C4 and C5, respectively. Once dates has been assigned a value, it can be used in the final calculation,
FILTER(dates,WEEKDAY(dates,2)<6)) // filter out weekends