Forum Discussion
pedroerbarbosa
Mar 02, 2021Copper Contributor
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 advance
Pedro
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.
2 Replies
- tbouldenIron Contributor
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.
- cuong
Microsoft
Chris_Gross can you help?