Excel Splines based interpolation

This webpage - with demo file - presents user defined functions (VBA) for generating a cardinal spline1, cubic spline2, and monotone cubic spline3 - curves that run exactly through your data points - and that return interpolated points.
If the graph of your data points is convex (or concave), then spline-based data interpolation will outperform linear interpolation, which will systematically overestimate (or underestimate) values between two consecutive data points.

Download demo file   (133kB - downloaded 3693 times)

  1. The cardinal spline has parameter tension, with a value between 0 and 1 (default 0.5). If set to 0, the spline reduces to straight lines between data points.
  2. The cubic spline typically yields a smoother overall curve than a cardinal spline, which may change direction more sharply near the data points, partly depending on its tension parameter.
  3. The monotone cubic spline’s advantage is that it avoids “wobbling” in the interpolated curve as it preserves monotonicity (see wikipedia). Monotonicity means a function moves in only one direction: it never increases then decreases (or never decreases then increases). Example below is clearly not monotone.
For an online equivalent, see online splines generator.
For interpolation within a 2-dimensional table, see Bilinear and spline based 2D-interpolation.
Excel Splines

MS Excel VBA code to be put in a module - array functions

In MS Excel, press Alt+F11 to open the Visual Basic Editor (Windows). Via top menu: Insert → Module. Copy the MS Excel VBA code of the functions into the module.


Your input data can now be column organized (default table) or row organized (transposed default table).









Regular function - Single Y value output only, given X value

In MS Excel, press Alt+F11 to open the Visual Basic Editor (Windows). Via top menu: Insert → Module. Copy the MS Excel VBA code of the functions into the module.