Forum Discussion

kheldar's avatar
kheldar
Iron Contributor
Mar 15, 2022

Lambda Without Paramaters N/A Error

Hello,

 

I've got a pretty complex set of lambdas referencing child lambdas.

 

 

=LAMBDA(LET(calc,ModStart($S$3,A2#),
IFS(ModMatchStart($S$3,A2#)>0,calc,
ModMatchStart($S$3-1,A2#)>0,ModStart($S$3-1,A2#)/1440,
ModMatchStart($S$3-2,A2#)>0,ModStart(S3-2,A2#)/1440,
ModMatchStart($S$3-3,A2#)>0,ModStart(S3-3,A2#)/1440,
ModMatchStart($S$3-4,A2#)>0,ModStart($S$3-4,A2#)/1440,
ModMatchStart($S$3-5,A2#)>0,ModStart($S$3-5,A2#)/1440,
ModMatchStart($S$3-6,A2#)>0,ModStart(S3-6,A2#)/1440,
ModMatchStart($S$3-7,A2#)>0,ModStart($S$3-7,A2#)/1440,
ModMatchStart($S$3-8,A2#)>0,ModStart($S$3-8,A2#)/1440,
ModMatchStart($S$3-9,A2#)>0,ModStart($S$3-9,A2#)/1440)))()

 

 

This is the lambda to call other lambdas. It works on the grid. However, if I call it in another cell with

 

 

=LambdaModStart()

 

 I get N/A Error.

 

All others lambdas are working as intended. Including this one but as I said it works only on grid.

 

What could be going wrong?


Also, I know this could be done with a loop but I couldn't wrap my head around recursive lambdas.


I'd really appreciate your help.

 

Thanks.

 

  • mtarler's avatar
    mtarler
    Silver Contributor
    I can't wrap my head around what you are trying to do but what I do see is that you are using IFS(). As I started my experiments with LAMBDA I also used IFS() and found out that it does not check the condition(s) and then perform the corresponding action, it will calculate every parameter in the set and then perform the IFS action. I don't know if that is your problem but I had a recursive action so the LAMBDA kept calling itself even though it should have stopped when it reached my target value, the IFS() would try to calculate all the terms and therefor kept recursively calling itself until it reached its stack limit and failed.
    • kheldar's avatar
      kheldar
      Iron Contributor
      Hmm... But on the grid it works as intended. Could it be still the same issue?
      • mtarler's avatar
        mtarler
        Silver Contributor
        I don't know. I don't know what each of those Lambda functions (ModMatchStart, ModStart, LambdaModStart) are and I don't know what you mean by 'on the grid' mean vs. what?
  • kheldar 

    Sorry but I haven't got the remotest idea what the formula is meant to achieve.  I don't know what is returned by A2#, nor what value S3 may contain.  I would need to see what

    ModMatchStart

    ModStart

    refer to.  At first sight, the initial Lambda and the null parameter string does nothing but return the LET and the LET itself does very little and could be eliminated.

     

    • kheldar's avatar
      kheldar
      Iron Contributor

      PeterBartholomew1 

       

      I'll try to prepare a sample file tonight. I know LET can be eliminated but it helps me visualize things better.

      ModMatchStart = identifies if there is a matching value.
      ModStart = retrieves the matching value.

       

      This is ModMatchStart:

      =LAMBDA(start,name,COUNTIFS(RawMMP[Name],name,RawMMP[Start],start,RawMMP[Non-Mod],"Mod"))

       This is ModStart:

       

      =LAMBDA(start,name,SUMIFS(RawMMP[Duration1],RawMMP[Name],name,RawMMP[Start],start,RawMMP[Non-Mod],"Mod"))

Resources