Kako napraviti novu funkciju upotrebom lambda

[:sr]Kako napraviti novu funkciju u Excel-u upotrebom LAMBDA[:en]How to create new function in Excel with LAMBDA[:]

[:sr]Napraviti funkciju u Excel-u upotrebom LAMBDA funkcije, omogućeno je korisniku da kreira sopstvenu funkciju bez poznavanja programiranja u VBA ili drugim komplikovanijim postupkom. Ova izrada nije teška i jednostavna je za svakog ko je išao u osnovnu školu.

Svrha LAMBDA funkcije u Excel-u

u verzijama2021, 365, za Mac i za veb

Iako se Excel pojavio 1987. godine, tek u godinama pandemije je doživeo revolucionarne promene. Dobro, možda još neke verzije Excel-a mogu dobiti taj pridev, ali pojava LAMBDA funkcije omogućava korisniku da kreira svoju sopstvenu funkciju bez potrebe da poznaje programiranje, Visual Basic-a i sl.

Čitava ideja proširenja skupa funkcija nije došla slučajno. Više o tome možete pročitati Blogu Microsoft-a i nespornom doprinosu Alonzo Church-a koji je dao veliki doprinos matematičkoj logici i teoriji računarske nauke.

U suštini cele priče kako napraviti funkciju u Excel-u upotrebom LAMBDA, je u stvari postupak pretvaranja formule u funkciju. Ako vas buni pojam funkcije ili formule u excelu više o tome možete pročitati u našem članku Razlika između formule i funkcije u Excel-u.

Jednostavno, prvi parametar ove funkcije, su promenljive koje ćemo koristiti i sama formula koja može biti čista matematička ili formirana od postoječih funkcija u excelu. Za najjednostavniji primer sam upotrebio promenljivu r i matematičku formulu kvadrata r*r.

Ovaj najjednostavniji primer je besmislen da ga koristimo, ali nam je dobar da napišemo svoju prvu LAMBDA funkciju.

Zašto napraviti novu funkciju u Excel-u upotrebom LAMBDA

Ako ste spremni da kreirate prvu sopstvenu funkciju, imajte u vidu da nije isto kada koristite LAMBDA funkciju u ćeliji tabele ili kada je ona imenovana kao nova funkcija.

Sintaksa funkcije je: =LAMBDA (promenljiva, …, formula)

LAMBDA funkcija kao i svaka druga se obično kreira i moguće greške, se otklanjaju u traci formule ispod menija, a zatim se po potrebi premeštaju u menadžer imena (name manager) da bi se dodelilo ime koje će se koristiti negde u datoteci.

Postoje četiri osnovna koraka za kreiranje i korišćenje prilagođene LAMBDA funkcije:

  1. Proverite logiku koju ćete koristiti sa standardnom formulom,
  2. Kreirajte i testirajte generičku (neimenovanu) LAMBDA verziju formule,
  3. Imenujte i definišite LAMBDA formulu pomoću menadžera imena,
  4. Pozovite novu prilagođenu funkciju sa definisanim imenom.

Primeri u nastavku govore o ovim koracima detaljnije.

Prvi primer: kako napraviti novu funkciju u Excel-u upotrebom LAMBDA

Najjednostavniji primer je kvadratna funkcija. Kao što vidite na slici u prvoj kolini se nalaze redni brojevi, a u drugoj koloni je iza znaka jednakosti pozvana funkcija LAMBDA.

Excel LAMBDA funkcija
Excel LAMBDA funkcija

=LAMBDA(r;r*r) prvi parametar je promenljiva kojoj sam ovde dao proizvoljno ime (malo slov r) drugi parametar je sama formula, u ovo slučaju jednostavna kada množim r puta r.

Iza zatvorene zagrade se nalaze adrese ćelija iz radne tabele čije vrednost će biti izračunate ovom funkcijom u zagradi (B3) itd.

Drugi primer: Definicija imena nove funkcije

Prvo bitnu definiciju =LAMBDA(r;r*r) treba uneti u Name Manager koji se nalazi na traci sa alatima Formulas.

Iz priložene slike možete videti koliko je to jednostavno.

Gotovu datoteku možete preuzeti ovde.

 

[:en]Creating a function in Excel using the LAMBDA function, allows the user to create their own function without knowledge of programming in VBA or other more complicated procedure. This making is not difficult and is easy for everyone who went to primary school.

The purpose of the LAMBDA function in Excel

in versions :  2021, 365, for  Mac  and for  web

Although Excel appeared in 1987, it was only in the years of the pandemic that it underwent revolutionary changes. Okay, maybe some more versions of Excel can get that adjective, but the advent of the LAMBDA function allows the user to create their own function without the need to know programming, Visual Basic, and the like.

The whole idea of ​​expanding the set of functions did not come by chance. You can read more about this in the Microsoft Blog and the indisputable contribution of Alonzo Church , who made a great contribution to mathematical logic and the theory of computer science.

In essence, the whole story of how to create a function in Excel using LAMBDA is actually the process of converting a formula into a function. If you are worried about the concept of a function or formula in Excel, you can read more about it in our article The difference between a formula and a function in Excel.

Simply, the first parameter of this function are the variables that we will use and the formula itself, which can be purely mathematical or formed from existing functions in excel. For the simplest example, I used the variable ri mathematical formula of the square r * r.

This simplest example is pointless to use, but it is good for us to write our first LAMBDA function.

Why create a new function in Excel using LAMBDA

If you are ready to create your first custom function, keep in mind that it is not the same when you use the LAMBDA function in a table cell or when it is named as a new function.

The syntax of the function is: = LAMBDA (variable,…, formula)

LAMBDA functions are usually created and debugged in the formula bar on the worksheet, and then moved to the name manager to assign a name that can be used anywhere in the workbook.

There are four basic steps to creating and using a custom LAMBDA feature:

  1. Check the logic you will use with the standard formula
  2. Create and test a generic (unnamed) LAMBDA version of the formula
  3. Name and define the LAMBDA formula using the name manager
  4. Call a new custom function with a defined name

The examples below discuss these steps in more detail.

First example: how to create a new function in Excel using LAMBDA

The simplest example is the quadratic function. As you can see in the picture, there are ordinal numbers in the first column, and in the second column, the LAMBDA function is called after the equals sign.

Excel LAMBDA funkcija
Excel LAMBDA function

LAMBDA (r; r * r) the first parameter is a variable that I have given here an arbitrary name (lowercase letter r) the second parameter is the formula itself, in this case simple when multiplying r times r.

Behind the closed parenthesis are the cell addresses from the worksheet whose value will be calculated by this function in parentheses (B3), etc.

Another example: Definition of a new function name

First, the essential definition = LAMBDA (r; r * r) should be entered in the Name Manager located on the Formulas toolbar.

You can see how simple it is from the attached picture.

You can download the finished file here.

[:]
5/5 - (2 votes)