A função LAMBDA cria funções personalizadas, permitindo escrever fórmulas reutilizáveis com diferentes entradas. Também oferece suporte a recursos avançados, como recursividade e funções de ordem superior.
=LAMBDA(Parâmetro 1 [; Parâmetro 2 [; ... [; Parâmetro n]...]]; Fórmula)
Parâmetro 1: (obrigatório) O nome do primeiro parâmetro da função. O nome deve seguir as regras de nomes de intervalo e não podem ser o resultado de uma referência ou fórmula de texto. O escopo do nome do parâmetro é restrito à função LAMBDA.
Parâmetro 2; ...; n : (opcional). Parâmetros adicionais da função. Aplicam-se as mesmas regras de nomes de Parâmetro 1.
Fórmula: uma expressão de fórmula. Deve ser o último argumento da função.
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.
Na célula B1 digite MINHA_MEDIA(2;3).
A célula B1 exibe o número 2,44948974278318, a raiz quadrada de 2 vezes 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.
Digite =MINHA_FATORIAL(5) na célula B1.
A célula B1 mostra o valor 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