Excel LAMBDA Recursion + a Trick for Evaluating in a Cell

Sdílet
Vložit
  • čas přidán 24. 07. 2024
  • Excel LAMBDA functions can also handle recursion. In this video I demonstrate with an easy example, plus show you a trick for evaluating recursive lambdas in a cell. Download the Excel file here: www.myonlinetraininghub.com/r...
    View my comprehensive courses: www.myonlinetraininghub.com/
    Connect with me on LinkedIn: / myndatreacy
  • Věda a technologie

Komentáře • 77

  • @rudiklein
    @rudiklein Před 3 lety +5

    🤯 I shouldn't be watching these kind of videos before going to sleep.

  • @IvanCortinas_ES
    @IvanCortinas_ES Před 3 lety

    Thank you for this tutorial Mynda. I am already waiting this function in my Excel 365. That's a very powerful function!

  • @guranslifes
    @guranslifes Před 9 měsíci

    you are the best 'teacher', Mynda, out of all MVPs

  • @patrickschardt7724
    @patrickschardt7724 Před 3 lety +2

    Keeping track of the exit strategy and testing recursion are very hard. Great stuff

  • @darrylmorgan
    @darrylmorgan Před 3 lety

    Hi Mynda!Great Tutorial.Very Interesting Plus Nice And Easy To Understand...Thank You :)

  • @abdelkrimmesaiahmed662

    Thank you for this amazing video

  • @realpulsecoin
    @realpulsecoin Před 3 lety

    Great content!

  • @mohammedahmed8295
    @mohammedahmed8295 Před 3 lety

    Appreciate your efforts

  • @kltzy
    @kltzy Před rokem

    Wasn't familiar with the ME functionality. Thanks Mynda, a good push in the right direction.

  • @sunnybaggu785
    @sunnybaggu785 Před rokem

    Your explanations, presentation and instructions are very good and interesting. Thank you for sharing excel tips this way. IAM sure many people like get to learn from your videos. Thank you..

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  Před rokem +1

      So nice of you to say so, Sunny! Thank you.

    • @sunnybaggu785
      @sunnybaggu785 Před rokem

      @@MyOnlineTrainingHub thank you madam, apart from youtube, we try to follow and get updates from your email subscription and LinkedIn too.

  • @ricos1497
    @ricos1497 Před 3 lety +1

    Nice, I like the use of ME, I might try that. The bit I struggle with is how to bail on complex recursive functions, maybe where you've added a counter or whatever. Even in your example, it's not completely obvious how returning 1 in the IF() statement actually causes the function to return 120 (and not 1). That's the bit I struggle with when writing out recursion with more than one parameter, and when let gets involved and so on. I've actually written a couple where I added in another cntr variable, and a text variable that passed back the "state" of variables in the LET function and the counter, so I could effectively see which loop the thing broke on!

    • @Excelambda
      @Excelambda Před 3 lety +1

      Haha, you are everywhere. Is very simple to understand how recursive works, (why is 120 and not 1), because only after finds the base case, the 1, has all the terms to conclude the calculation .
      for example fact(4) computer > 4 * fact(3) > 4*3*fact(2) > 4*3*2*fact(1) >condition met fact(1) =1 > 4*3*2*1 bam result 24
      That's the idea of recursive, never leaves the calculation , continues because it calls itself but finishes only when it has all the terms known.

    • @ricos1497
      @ricos1497 Před 3 lety +1

      @@Excelambda Yes, that's a great way of explaining it! When I said it wasn't completely obvious, I meant to the layperson. It's a concept that doesn't exist elsewhere in Excel, and doesn't quite explain itself, so if you're looking at a recursive function, it's difficult to get by just looking at it. I'll steal your explanation for when I have to explain it to others!

  • @gheorghebidiac2975
    @gheorghebidiac2975 Před 3 lety +3

    As you said: "mind bending"! :D

  • @DougHExcel
    @DougHExcel Před 3 lety

    Great example! LAMBA could replace some VBA scripting so it's good to know

  • @samaruti9446
    @samaruti9446 Před 7 měsíci

    Mynda, you have a great way of taking something complex and making it simple to understand, Can you please do the same with the ME parameter?

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  Před 7 měsíci

      Thanks for your kind words! I know what you mean about the ME parameter. I'll add it to the list 😁

  • @chrism9037
    @chrism9037 Před 3 lety +1

    Wow. Time for an Advil, Mynda!

  • @johannes3020
    @johannes3020 Před 3 lety

    Hello, I have a problem: I'm trying to make a stock price chart show the points at which I've purchased the stock. Would you know how to do this? My attempts fail since the dynamic arrays conflict with each other. Thanks if you'll devote some time to helping.

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  Před 3 lety

      Hi Johannes, please post your question and sample Excel file on our forum where we can help you further: www.myonlinetraininghub.com/excel-forum

  • @asgharhussain7205
    @asgharhussain7205 Před 3 lety +1

    Hi, in my excel workbook I have 200+ sheets & sheet names defined.
    Every sheet contains data like student name father name address and mob no.s
    if I enter sheet name I should get all the data in that particular sheet

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  Před 3 lety

      Unfortunately, the structure of the file goes against best practice, so any way you approach this will be a workaround. I recommend you use Power Query (czcams.com/video/L4BuUzccLpo/video.html) to consolidate the data into the correct tabular format: www.myonlinetraininghub.com/excel-tabular-data-format

    • @asgharhussain7205
      @asgharhussain7205 Před 3 lety

      ​@@MyOnlineTrainingHub Thanks for reply, I've seen the video and your website, I have my data in one workbook and in that I have 200+ sheets (tabs). The data is well defined and in good format. All I want is, in the index sheet (tab), if I enter the sheet(tab) name I should get the data present in that particular sheet(tab). Just like vlookup. I watched all your vlookup videos and liked it, In vlookup the lookup value is a cell, I get one cell data from different sheet, here the lookup value should be sheet name & I want all cells data or multiple cell data from different sheet by entering sheet name.

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  Před 3 lety

      I understand what you want, but formulas are not suitable. You should fix the data layout and then you can use Slicers to filter the data to show what you want.

    • @asgharhussain7205
      @asgharhussain7205 Před 3 lety

      @@MyOnlineTrainingHub Ok mam understood, thanks a lot

  • @sktneer
    @sktneer Před rokem +1

    Another way to do this is as below...
    Assuming the number is in A2, then to find the factorial of the number in A2, we may use the following formula directly in the cell.
    In B2
    =REDUCE(1,SEQUENCE(A2),LAMBDA(n,r,n*r))

  • @JoseAntonioMorato
    @JoseAntonioMorato Před 3 lety

    I really liked the explanation of the possibility of testing the recursive LAMBDA using the LET function 👍, but this is not very simple to use. 🤔
    I inform you that the download file link was missing. 😊

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  Před 3 lety

      Thanks, Jose. Not much about LAMBDA is easy. It's an advanced technique, but hopefully you can adapt the examples to your own formulas. I've added the link now. Sorry about that.

    • @JoseAntonioMorato
      @JoseAntonioMorato Před 3 lety

      @@MyOnlineTrainingHub It is an advanced technique, but with the help of videos like yours, little by little we will be able to understand. Thankful. 🤗

  • @TheEXCELGURU
    @TheEXCELGURU Před 3 lety

    Hi there, i don't see the download link

  • @abdelkrimmesaiahmed662

    Mynda there is no link to download the excel file

  • @drsteele4749
    @drsteele4749 Před 3 lety

    Does the fact you're using LAMBDA cause your cursor to jump down one cell after every entry, forcing you to move it up every time?

  • @ZaneRinke
    @ZaneRinke Před 2 měsíci

    Mynda, Help! Surely one can use Lambda and it's recursive nature to create a Goal-Seek function. All searches fall short.

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  Před 2 měsíci

      I imagine so, but I don't have any tutorials I can point you to and I suspect Goal Seek is more efficient.

    • @ZaneRinke
      @ZaneRinke Před 2 měsíci +1

      Thank you for responding.
      Normally, I would use goal seek, but here we are talking about hundreds of lines, with changing variables. I was hoping for a formula based solution.

  • @GeertDelmulle
    @GeertDelmulle Před 3 lety

    That ME parameter must be something special, because defining recursive LAMBDAs as a local variable in LET normally doesn't work in my experience.
    Good to know. Thanks.

    • @GeertDelmulle
      @GeertDelmulle Před 3 lety

      Hey Mynda,
      Here's a little challenge for you: another famous example for recursion (ever since the Middle Ages) are the Fibonacci numbers: F(n)=F(n-1)+F(n-2). It leads to the concept of the Golden Ratio.
      Can you show us how to create a recursive LAMBDA for this and calculate, for instance, Fibonacci(55)?
      While you're at it, maybe you want to do this both in Excel using a recursive LAMBDA and in Power Query as well, since you know so well how to calculate recursive things in the most efficient way in PQ-M...
      Are you up for the challenge?

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  Před 3 lety +1

      Hi Geert! Fellow MVP Liam Bastick has written about using LAMBDA for Fibonacci here: www.sumproduct.com/news/article/lambda-formulaic-recursion-its-all-about-me

    • @GeertDelmulle
      @GeertDelmulle Před 3 lety

      @@MyOnlineTrainingHub Ah! you're so lazy! LOL! :-)
      Just kidding. Yes, he got it right and linearized the calculation (the default 'trap'-implementation actually has a Fibonacci series for the calculation time itself, so you do not want to use that.)
      BTW: you don't need a double IF, so his formula can be simplified further, ever so slightly.
      FYI, you can check out the Mr.Excel Message Board in the LAMBDA section for other implementations (we didn't use the ME function there).

  • @George-lp3qb
    @George-lp3qb Před rokem

    Also they need to come up with a solution for the argument IntelliSense, otherwise, in my opinion, VBA UDF is still better especially that it is application level

  • @micheleradogna4921
    @micheleradogna4921 Před 3 lety

    Can i use factorial for obtain a list? For example, if i want a list with all the number, between 5 and 1(4,3,2,1). Once for a Row.
    *5*
    4
    3
    2
    1

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  Před 3 lety +1

      Hi Michele, you can use the SEQUENCE function for this: www.myonlinetraininghub.com/excel-sequence-function

  • @RR-fv2uu
    @RR-fv2uu Před 3 lety

    can u help me

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  Před 3 lety

      You can post your question and sample Excel file on our forum where we can help you further: www.myonlinetraininghub.com/excel-forum

  • @romulusmilea2747
    @romulusmilea2747 Před 2 lety

    One question about 3:30 moment: then name was defined, you did not put the = sign before that IF, on the Refer to field. Excel users who used/created named formulas in the past, or even simple names did use = sign. Why this detail was not explained ? I have observed that many Excel experts on CZcams are in competition with each other, who can explain faster, and faster, details do not matter, the ultimate goal is to be as quick as possible. This is not teaching, it is just speeding. However, you do not seem to be one of them, but still I do not understand why explanation about that = sign is missing (surprisingly, on 5:21 the equal sign was used). Thank you.

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  Před 2 lety

      Hi Romulus, the formula does include the equals sign, it's just that the formula is long and you're only seeing the second line in the name manager. If you notice the formula I copy from the cell at 3:18 includes the equals sign.

  • @beegdigit9811
    @beegdigit9811 Před rokem

    Excel has become a functional programming language lol