Forum Discussion
Twifoo
Mar 25, 2021Silver Contributor
Receivable Aging Formula Challenge
Forty-five days after I posted my FIFO Inventory Formula Challenge and my solution thereto, here is another challenge to harden your array manipulation skills. As usual, we anticipate the valuable in...
PeterBartholomew1
Apr 01, 2021Silver Contributor
I have worked through the problem (yet to look at other solutions). At the moment, I would say my solution is overweight and lacking elegance! It will produce a column array for each customer (I try to get one formula for an entire table but it is often not possible without Lambda recursion).
=LET(
receive, LET(
ac, SUMIFS(TrnAmt, CtmrName,@CName, TrnType,Type),
MMULT({1,-1},ac)),
crit, (CtmrName=@CName)*(TrnType=Sale),
Age, Cutoff - FILTER(TrnDate, crit),
Amt, FILTER(TrnAmt, crit),
Age′, TRANSPOSE(Age),
Accumulate, SIGN(Age′<=Age),
Difference, MINVERSE(Accumulate),
Accum, MMULT(Accumulate, Amt),
capped, IF(Accum<receive,Accum,receive),
outstanding, MMULT(Difference,capped),
Assign, (Age′>=LowerBracket)*(Age′<=UpperBracket),
byBand, MMULT(Assign, outstanding),
byBand)
- TwifooApr 01, 2021Silver ContributorI appreciate your humble admission. I am certain you could improve your formula by perhaps avoiding the repetition of LET.
- PeterBartholomew1Apr 02, 2021Silver Contributor
Made it. I think this is my best endeavour.
=LET( a,SUMIFS(TrnAmt,CtmrName,N,TrnType,"S*",TrnDate,">="&Cutoff-UpperBracket), b,INDEX(a,4,)-SUMIFS(TrnAmt,CtmrName,N,TrnType,"C*"), D,{1,0,0,0;-1,1,0,0;0,-1,1,0;0,0,-1,1}, MMULT(D,IF(a<b,a,b)))
The formula produces the 4x4 result as a dynamic array.
I suspect that I have used your problem as a learning exercise rather than strictly following the rules but thanks anyway.
- TwifooApr 02, 2021Silver ContributorI also suspect that your formula use of the array constants will become inapplicable when the data is modified.
- PeterBartholomew1Apr 02, 2021Silver Contributor
- PeterBartholomew1Apr 02, 2021Silver ContributorNow as I understand the problem, I think I have an idea for an improved solution making better use of the initial SUMIFS. I won't look at your solution yet!