I need a smoothing spline function for use in Excel.
1) it is to be written in C# using Exceldna (independent project to integrate .NET into Excel)
2) you are expected to deliver the function as both the code so I can see the method as well as create the xll file in Visual Studio myself, and also the xll file itself and an excel file with a working example.
3) the inputs to the function should contain at least the following:
d) Smoothing parameter is between 0 and 1.
The PeriodRange will take in a column or row range that has the following inputs:
a) a date in normal excel date format, the date must be the first of a month, if not, the function needs to give an error message.
b) a calendar quarter reference in the following format "Q1 2017". If not in this format then the function needs to give an error message.
c) a calendar year reference in the following format "2017". If not in this format then the function needs to give an error message.
d) Smoothing parameter is between 0 and 1. If outside this range then the function should return an error message.
The PricesRange are all decimal e.g. 100.35 and could be positive or negative.
The Period is the date that the cubic spline function returns the value for. The date must be the first of a month, if not, the function needs to give an error message
The spline curve needs to maintain the averages of the calendar quarters and years.
The PeriodRange will typically be the first few months including the current month, the next few calendar quarters and the next few calendar years. The exact selection will often vary so the function should be able to adapt to that.
The code needs to be very fast as it will be ran about 2000 times per second.