Forum Discussion
Dynamic formula that splits/distributes revenue a value among various monthly start and end dates
The function was extracted from a workbook that used a month-based timeline with period start and period end dates (the 1st and 28/29/30/31st respectively). It could be that would be more use to you.
Some functions:
Addλ = LAMBDA(x, y, x + y);
Timelineλ = LAMBDA(modelStart, duration, [option],
LET(
numberPeriods, duration*MPY,
counter, SEQUENCE( , numberPeriods),
periodEnds, EOMONTH(modelStart, counter-1),
periodStarts, 1 + EOMONTH(periodEnds, -1),
SWITCH(option, 0, periodStarts, 1, periodEnds, counter)
));
UniformSpreadλ = LAMBDA(amount, eventStart, [duration],
LET(
months, IF(ISOMITTED(duration),1,duration),
eventFinish, EOMONTH(eventStart, months - 1),
withinPeriod, (modelPeriodBegins# >= eventStart) *
(modelPeriodEnd# <= eventFinish),
IF(withinPeriod, amount/months, 0)
)
);
SeasonallyAdjustedλ = LAMBDA(base, adjustment,
LET(
appliedSeasonalityAdj, INDEX(adjustment, MONTH(modelPeriodBegins#)),
appliedSeasonalityAdj * base
));
StepIncreaseλ = LAMBDA(base, ratio, eventStart,
IF(modelPeriodBegins#<eventStart, base, base*ratio)
);The book also had a function to accumulate a balance from inflows and outflows and apply interest payment on positive balances but that is well out of scope here.
Also I would need to convert from the start and end dates from Coulmns A &B in MM/DD/YYYY to MM/YYYY for columns C: last column
- FHamad007May 31, 2024Copper Contributor
PeterBartholomew1 I am looking for some help to create the excel formulas (If and AND /OR ) Functions for the following dependent on the "Treatment" Column. If Spread evenly, then cost should split evenly over the start and end date. If End of Quarter, then should be adjusted accordingly and so on. Can you help?
Treatment Start End Cost Spread evenly 4/1/2024 12/31/2026 100 End of Quarter 1/1/2025 12/31/2026 100 End of Month 9/22/2024 12/31/2028 100 Annually 6/26/2025 11/1/2027 100 Bi Annual 11/1/2024 11/1/2027 100 One time 8/11/2024 - PeterBartholomew1Sep 28, 2022Silver Contributor
The formula used functionality that is only available in 365 and started rollout around the beginning of 2019. A starting point would be the Microsoft blog posts on Dynamic Arrays, Lambda Functions and Lambda helper functions. The last thing to appear was the array shaping functions such as VSTACK.