♥ Doe para nosso projeto! ♥

LAMBDA

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.

Sintaxe

=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.

Utilização

Ícone Nota

For interoperability with other office suites, the LAMBDA function must be entered as a named formula.


  1. Open menu Sheets - Named Range and Expressions - Define.

  2. Assign a name to the expression.

  3. Write the LAMBDA function expression in the Range or formula expression box.

  4. Use the named expression, passing the parameters for the LAMBDA function.

Exemplos

Exemplo de uma média geométrica simples

  1. Assign name MY_MEAN as a named expression.

  2. Enter =LAMBDA(Number1;Number2;SQRT(Number1*Number2)) in the Range or formula expression box.

  3. Na célula B1 digite MINHA_MEDIA(2;3).

  4. A célula B1 exibe o número 2,44948974278318, a raiz quadrada de 2 vezes 3.

Ícone Nota

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.


Exemplo de uma chamada recursiva de uma função LAMBDA

  1. Assign name MY_FACTORIAL to a named expression

  2. Enter =LAMBDA(n;IF(n>1;n*MY_FACTORIAL(n-1);1)) in the Range or formula expression box.

  3. Digite =MINHA_FATORIAL(5) na célula B1.

  4. A célula B1 mostra o valor 120.

Utilizar ÉOMITIDO numa função LAMBDA

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.

Informação técnica

Ícone Dica

Esta função está disponível desde o LibreOfficeDev 27.2.


Esta função não faz parte do padrão Open Document Format for Office Applications (OpenDocument) Versão 1.4. Parte 4: Formato de Fórmula Recalculada (OpenFormula). O espaço de nomes é

COM.MICROSOFT.LAMBDA