Maybe this will work for you. I created a table in G2:H37 of years with arbitrary amounts for the budget of each year going to the year 2050.
First year calculation which calculates days of the year instead of months that can have a varying number of days.
Formula:
=INDEX(H:H,MATCH(YEAR(C2),G:G,0))*((DATEDIF(C2,DATE(YEAR(C2)+1,MONTH(1),DAY(1)),"d"))/365)
Last year calculation:
Formula:
=INDEX(H:H,MATCH(YEAR(C3),G:G,0))*(DATEDIF(DATE(YEAR(C3),MONTH(1),DAY(1)),C3,"d")/365)
Calculation of years between start and end
Formula:
=SUMPRODUCT((G2:G37>--YEAR(C2))*(G2:G37<--YEAR(C3))*(H2:H37))
Total amount from Start to End
Formula:
=INDEX(H:H,MATCH(YEAR(C3),G:G,0))*(DATEDIF(DATE(YEAR(C3),MONTH(1),DAY(1)),C3,"d")/365)+INDEX(H:H,MATCH(YEAR(C2),G:G,0))*((DATEDIF(C2,DATE(YEAR(C2)+1,MONTH(1),DAY(1)),"d"))/365)+SUMPRODUCT((G2:G37>--YEAR(C2))*(G2:G37<--YEAR(C3))*(H2:H37))
The workbook enclosed has the table created as well as the steps broken down and the final calculation. If you want to keep the steps you can simplify the total calculation by simply summing the steps that I have included.
The amount calculated works out to odd cents not equalling your round total but it is less than $1.00 difference.
Bookmarks