Prosimy o wsparcie!

LAMBDA

Funkcja LAMBDA tworzy funkcje niestandardowe, umożliwiając pisanie formuł wielokrotnego użytku z różnymi danymi wejściowymi. Obsługuje również zaawansowane funkcje, takie jak rekurencja i funkcje wyższego rzędu.

Składnia

=LAMBDA(parametr 1 [; parametr 2 [; ... [; parametr n]...]]; formuła)

Parametr 1: (wymagany) nazwa pierwszego parametru funkcji. Nazwa musi być zgodna z regułami nazewnictwa zakresów i nie może być wynikiem odwołania ani formuły tekstowej. Zakres nazwy parametru jest ograniczony do funkcji LAMBDA.

Parametr 2; ...; n : (opcjonalny). dodatkowe parametry funkcji. Obowiązują te same zasady nazewnictwa dla Parametru 1.

Formuła: wyrażenie formuły. Musi być ostatnim argumentem funkcji.

Użycie

Ikona notatki

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.

Przykłady

Przykład prostej średniej geometrycznej

  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. W komórce B1 wpisz =MOJA_ŚREDNIA(2;3).

  4. Komórka B1 wyświetla liczbę 2,44948974278318, czyli pierwiastek kwadratowy z 2 razy 3.

Ikona notatki

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.


Przykład rekurencyjnego wywołania funkcji 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. Wpisz =MOJA_SILNIA(5) w komórce B1

  4. Komórka B1 będzie wyświetlać 120.

Użycie ISOMITTED w funkcji 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.

Szczegóły techniczne

Ikona wskazówki

Ta funkcja jest dostępna od wersji 27.2 LibreOfficeDev.


Ta funkcja NIE jest częścią standardu Open Document Format for Office Applications (OpenDocument) Version 1.4. Part 4: Recalculated Formula (OpenFormula) Format. Przestrzeń nazw to

COM.MICROSOFT.LAMBDA