I'm going crazy and starting to think this is impossible. I am struggling with a complex nested IF formula. I have most of it figured out and I use LET to help with readability. The part that is stumping me has to do with calculating prorations. Basically, I have a fee % schedule where the fee changes every x number of years. I have a dozen funds to calculate quarterly fees for, all with different inception dates. This would be simple enough to calculate the appropriate fee for which ever quarter the fund happens to be in, by looking it up in the fee table, however I also need to account for partial quarters when the fee changes occur, in cases where the inception dates fall in the middle of a quarter. So the task is to calculate the fees on a typical 3/31, 6/30, 9/30, 12/31 schedule, but if the fund started on say, 4/20, then the fee for that quarter would be a sum of the prorated first fee and the prorated following fee.
Here is my work thus far. I will add the other complicating factors as well, making up an IF nest:
There are 2 types of funds, FundA and FundB, each with a different fee schedule
The fees are based on Size in years 1-10 and NAV in years 11-12
Prorations should happen any time the calculation changes, whether its due to fee change, or switch from Size to NAV
I also have the following UDFs:
QuarterDifference(startdate, enddate) = number of quarters between two dates
QuarterStart(date) = starting date of the quarter
QuarterEnd(date) = ending date of the quarter
Cell F2:
=LET(
Fund, $A2,
QD, quarterdifference($C2, F$1),
FundRate, XLOOKUP(QD, $C$26:$C$73, $D$26:$D$73) / 365,
FundBRate, XLOOKUP(QD, $C$26:$C$73, $E$26:$E$73) / 365,
FirstQFund, (XLOOKUP(1, $C$26:$C$73, $D$26:$D$73) / 365 * $D2 * (F$1 - $C2)),
FirstQFundB, (XLOOKUP(1, $C$26:$C$73, $E$26:$E$73) / 365 * $D2 * (F$1 - $C2)),
QuarterComm, $D2 * (QuarterEnd(F$1) - QuarterStart(F$1)+1),
QuarterNAV, $E2 * (QuarterEnd(F$1) - QuarterStart(F$1)+1),
Result, IF(Fund = "FundA",
IF(QD < 0, 0,
IF(QD = 0, FirstQFund,
(FundRate * QuarterComm)
)
),
IF(QD < 0, 0,
IF(QD = 0, FirstQFundB,
(FundBRate * QuarterComm)
)
)
),
Result
)
The formula goes in the yellow cells in the screenshot. The fee table is on the bottom. (I can't post links/pictures yet :/)
Bookmarks