Forum Discussion

pedroerbarbosa's avatar
pedroerbarbosa
Copper Contributor
Mar 02, 2021
Solved

Calculate a Sum with Lambda

I defined a recursive lambda call "Sum_L" to calculate the Sum of nth parcels but received #value =LAMBDA(tcp,tt,n,IF(n<1,0,Sum_L(n-1)+((1+tcp)/(1+tt))^n)) Can u help to resolve this?   Thanks in...
  • tboulden's avatar
    Mar 02, 2021

    Your lambda requires three parameters (tcp, tt, n), so your reference to itself should have 3 parameters as well. If tcp, tt don't change, it would be this: LAMBDA(tcp,tt,n,IF(n<1,0,Sum_L(tcp,tt,n-1)+((1+tcp)/(1+tt))^n))

     

    Please see attached.