Hi - I need to write a function that takes, as input:

Start date
End date
Initial deposit

I have a table that has the interest rate (APR) for each year. The dates will have a resolution of days. I need to calculate out how much money would be in an account on the end date if the initial deposit had been put in on the start date.

I can imagine a very brute force method of writing the script that does this - but does Excel have any nice built in functions for this?

I'm imagining something like:

Find interest earned from start date to end of year. I would need to extract out the exact year [YEAR(start date)] and then the number of days remaining in the year [something like ["12/31/" & YEAR(start date) - start date]]. I would then need to figure out the number of days in that year, so I guess that would look like: [("12/31/" & YEAR(start date - 1)) - "12/31/" & YEAR(start date))] and then I'd multiple the interest rate by the number of days remaining in the year divided by the number of days in the year. I'd multiply my initial deposit by that product.

Then I'd continue multiplying the products by the interest rates and I could keep on going but I think you get the idea.

This seems really brute force. Surely there is a better way.