ecomag,
Forget the formula for a moment and instead please explain where your expected results come from.
[TABLE="width: 584"]
<tbody>[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]correct interest rate for year payment and as date of payment[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD="colspan: 3"]REFERENCE YEAR AMOUNT[/TD]
[TD]interest rate from FORMULA[/TD]
[TD]INTEREST[/TD]
[/TR]
[TR]
[TD="align: right"]252,470.00[/TD]
[TD="align: center"]A
[/TD]
[TD="align: right"]2019[/TD]
[TD="align: right"]2019[/TD]
[TD="align: right"]2,524.70[/TD]
[TD]0.16[/TD]
[TD]16%[/TD]
[/TR]
[TR]
[TD="align: right"]23,640.00[/TD]
[TD="align: center"]B
[/TD]
[TD="align: right"]2018[/TD]
[TD="align: right"]2018[/TD]
[TD="align: right"]236.4[/TD]
[TD]0.16[/TD]
[TD]40%[/TD]
[/TR]
[TR]
[TD="align: right"]23,640.00[/TD]
[TD="align: center"]C
[/TD]
[TD="align: right"]2017[/TD]
[TD="align: right"]2017[/TD]
[TD="align: right"]236.4[/TD]
[TD]0.16[/TD]
[TD]64%[/TD]
[/TR]
[TR]
[TD="align: right"]23,640.00[/TD]
[TD="align: center"]D
[/TD]
[TD="align: right"]2001[/TD]
[TD="align: right"]2016[/TD]
[TD="align: right"]3,782.40[/TD]
[TD]0.16[/TD]
[TD]72%[/TD]
[/TR]
</tbody>[/TABLE]
Let's skip Row A.
Row B has the same year, 2018, twice and I don't know why. The 40% expected could only be retrieved from your test data if you you were looking for August 2018. So are you saying the $Q$10 date of 27-Aug-19 should have the day and year ignored as you were only trying to specify a month to use?
Row C has the same questions. Why 2017 twice? Should it be retrieving $Q$10 month of the first 2017 or the second?
Row D has 2001 and 2016 years but why? Yes, I understand 72% is from the last entry for 1992 but why two years and no month?
i was reffering to this table of penalties
[TABLE="class: cms_table, width: 885"]
<tbody>[TR]
[TD="colspan: 3"]TABLE OF PENALTIES[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]january[/TD]
[TD]february[/TD]
[TD]march[/TD]
[TD]april[/TD]
[TD]may[/TD]
[TD]june[/TD]
[TD]july[/TD]
[TD]august[/TD]
[TD]september[/TD]
[TD]october[/TD]
[TD]november[/TD]
[TD]december[/TD]
[/TR]
[TR]
[TD="align: right"]1973[/TD]
[TD="align: right"]12%[/TD]
[TD="align: right"]12%[/TD]
[TD="align: right"]12%[/TD]
[TD="align: right"]12%[/TD]
[TD="align: right"]12%[/TD]
[TD="align: right"]12%[/TD]
[TD="align: right"]12%[/TD]
[TD="align: right"]12%[/TD]
[TD="align: right"]12%[/TD]
[TD="align: right"]12%[/TD]
[TD="align: right"]12%[/TD]
[TD="align: right"]12%[/TD]
[/TR]
[TR]
[TD="align: right"]1974[/TD]
[TD="align: right"]24%[/TD]
[TD="align: right"]24%[/TD]
[TD="align: right"]24%[/TD]
[TD="align: right"]24%[/TD]
[TD="align: right"]24%[/TD]
[TD="align: right"]24%[/TD]
[TD="align: right"]24%[/TD]
[TD="align: right"]24%[/TD]
[TD="align: right"]24%[/TD]
[TD="align: right"]24%[/TD]
[TD="align: right"]24%[/TD]
[TD="align: right"]24%[/TD]
[/TR]
[TR]
[TD="align: right"]1992[/TD]
[TD="align: right"]72%[/TD]
[TD="align: right"]72%[/TD]
[TD="align: right"]72%[/TD]
[TD="align: right"]72%[/TD]
[TD="align: right"]72%[/TD]
[TD="align: right"]72%[/TD]
[TD="align: right"]72%[/TD]
[TD="align: right"]72%[/TD]
[TD="align: right"]72%[/TD]
[TD="align: right"]72%[/TD]
[TD="align: right"]72%[/TD]
[TD="align: right"]72%[/TD]
[/TR]
[TR]
[TD="align: right"]2017[/TD]
[TD="align: right"]50%[/TD]
[TD="align: right"]52%[/TD]
[TD="align: right"]54%[/TD]
[TD="align: right"]56%[/TD]
[TD="align: right"]58%[/TD]
[TD="align: right"]60%[/TD]
[TD="align: right"]62%[/TD]
[TD="align: right"]
64%[/TD]
[TD="align: right"]66%[/TD]
[TD="align: right"]68%[/TD]
[TD="align: right"]70%[/TD]
[TD="align: right"]72%[/TD]
[/TR]
[TR]
[TD="align: right"]2018[/TD]
[TD="align: right"]26%[/TD]
[TD="align: right"]28%[/TD]
[TD="align: right"]30%[/TD]
[TD="align: right"]32%[/TD]
[TD="align: right"]34%[/TD]
[TD="align: right"]36%[/TD]
[TD="align: right"]38%[/TD]
[TD="align: right"]
40%[/TD]
[TD="align: right"]42%[/TD]
[TD="align: right"]44%[/TD]
[TD="align: right"]46%[/TD]
[TD="align: right"]48%[/TD]
[/TR]
[TR]
[TD="align: right"]2019[/TD]
[TD="align: right"]-10%[/TD]
[TD="align: right"]-10%[/TD]
[TD="align: right"]-10%[/TD]
[TD="align: right"]8%[/TD]
[TD="align: right"]10%[/TD]
[TD="align: right"]12%[/TD]
[TD="align: right"]14%[/TD]
[TD="align: right"]16%[/TD]
[TD="align: right"]18%[/TD]
[TD="align: right"]20%[/TD]
[TD="align: right"]22%[/TD]
[TD="align: right"]24%[/TD]
[/TR]
[TR]
[TD="align: right"]2020[/TD]
[TD="align: right"]-20%[/TD]
[TD="align: right"]-20%[/TD]
[TD="align: right"]-20%[/TD]
[TD="align: right"]-20%[/TD]
[TD="align: right"]-20%[/TD]
[TD="align: right"]-20%[/TD]
[TD="align: right"]-20%[/TD]
[TD="align: right"]-20%[/TD]
[TD="align: right"]-20%[/TD]
[TD="align: right"]-20%[/TD]
[TD="align: right"]-20%[/TD]
[TD="align: right"]-20%[/TD]
[/TR]
</tbody>[/TABLE]
40% on year 2018 because payment made is august 2019 (Q10), as per table (highlighted red). same as year 2017 which 64%. 2 columns for year because, from to to (2001-2016).