LAMBDA-funksjonen lagar eigendefinerte funksjonar, slik at du kan skriva formlar som kan brukast i andre samanhangar med ulike inndata. Funksjonen støttar også avanserte funksjonar som rekursjon og funksjonar av høgare orden.
=LAMBDA(Parameter 1 [; Parameter 2 [; … [; Parameter n]…]; Formel)
Parameter 1: (obligatorisk). Namnet på den første parameteren til funksjonen. Namnet må følja reglane for områdenamn og kan ikkje vera resultatet av ein referanse eller tekstformel. Omfanget av parameternamnet er avgrensa til LAMBDA-funksjonen.
Parameter 2; ...; n: (valfritt). Fleire parameterar for funksjonen. Dei same namnereglane som for Parameter 1 gjeld.
Formel: eit formeluttrykk. Det må vera det siste argumentet i funksjonen.
For interoperability with other office suites, the LAMBDA function must be entered as a named formula.
Open menu .
Assign a name to the expression.
Write the LAMBDA function expression in the box.
Use the named expression, passing the parameters for the LAMBDA function.
Assign name MY_MEAN as a named expression.
Enter =LAMBDA(Number1;Number2;SQRT(Number1*Number2)) in the box.
Skriv inn =MY_MEAN(2;3) i cella B1.
Celle B1 viser talet 2,44948974278318, kvadratrota av 2 gongar 3.
If you don’t assign a name to LAMBDA expression, you can still use it by entering the formula in cell A1 and enter =A1(2;3) in B1. The LAMBDA function displays the Greek character lambda (λ) in cell A1. However, this makes the formula less readable and will cause interoperability issues with other office suites.
Assign name MY_FACTORIAL to a named expression
Enter =LAMBDA(n;IF(n>1;n*MY_FACTORIAL(n-1);1)) in the box.
Skriv inn =MY_FACTORIAL(5) i celle B1
Celle B1 vil visa 120.
The ISOMITTED function allows you to handle missing parameters in a LAMBDA function. For example, the LAMBDA function named MY_FUNCT:
=LAMBDA(_n1; _n2; IF(ISOMITTED(_n2); "Missing second parameter"; _n1/_n2))
returns "Missing second parameter" if the LAMBDA function is called as =MY_FUNCT(3;). Note: The trailing argument separator (;) must be included in the function call.
COM.MICROSOFT.LAMBDA