Tarsier Tools
Linear Interpolation Function
Overview Designed for OpenOffice.org Calc and Microsoft Excel, this "Tarsier Tool" interpolates between consecutive ordered points from the given data. The function can be configured to interpolate using either a step or linear function. If the input value is outside of the range of the X coordinates the function can be configured to either perform a linear extrapolation using the two nearest points; return a constant value of the nearest value or return the Excel #Num value.

Please note that this Tarsier tool is distributed with NO WARRANTY.

This page contains the following information on this Tarsier Tool.
Usage Instructions
License Fee
How to Install
How to Uninstall
Revision History
Software for Download
Source Code
Technical Support
Further Information

Usage Instructions To use the Linear Interpolation Function:
The following instructions assume you know how to use functions in Calc or Excel. In Excel my linear interpolation function can be found either under the "All" or under "User defined" in the function menu, but in Calc you will have to type the function name.
The function has three mandatory arguments and two optional arguments.
You must;
  1. specify the range of cells containing the known X values, (argument known_x)
  2. specify the range of cells containing the known Y values, (argument known_y)
  3. specify the X value you are interpolating against, (argument x_Value)

With this information the function will perform linear interpolation to find the specified value, or extrapolate to find the Y value if the X value is outside the range of known X values.

Additionally, you can specify the following options;

  1. what value should be returned if the X value interpolated against is outside the range of known X values, (argument cutOffAction, 0 = extrapolate; 1 = cut off at the nearest known value, 2 = return #NUM! or -999 in Calc)
  2. use step interpolation, (argument step, a binary value, false = perform linear interpolation, true = perform stepwise interpolation)
Important Note:
The known X values must be in numerical order, minimum to maximum.

How to specify the result calculated by the function The values in the Example result column are calculated using the following data.
Example data

Description x_value cutOff step Example formula (Excel Calc) Result
Compulsory arguments - within X value range 1.5 Not specified Not specified =LinearInterpolator($A$2:$A$7,$B$2:$B$7,1.5) 2.7
Compulsory arguments - outside X value range -1.0 Not specified Not specified =LinearInterpolator($A$2:$A$7,$B$2:$B$7,-1.0) 0.5
6.0 Not specified Not specified =LinearInterpolator($A$2:$A$7,$B$2:$B$7,6.0) 35.5
Cut off if outside X value range -1.0 1 Not specified =LinearInterpolator($A$2:$A$7,$B$2:$B$7,-1.0,1) 0.8
6.0 1 Not specified =LinearInterpolator($A$2:$A$7,$B$2:$B$7,6.0,1) 26.0
Return error if outside X value range -1.0 2 Not specified =LinearInterpolator($A$2:$A$7,$B$2:$B$7,-1.0,2) #NUM!
6.0 2 Not specified =LinearInterpolator($A$2:$A$7,$B$2:$B$7,6.0,2) #NUM!
Stepwise interpolation - within X value range 1.5 0, 1, 2 True =LinearInterpolator($A$2:$A$7,$B$2:$B$7,1.5,0,True) 1.1
2.001 0, 1, 2 True =LinearInterpolator($A$2:$A$7,$B$2:$B$7,2.001,0,True) 4.3
3.9999 0, 1, 2 True =LinearInterpolator($A$2:$A$7,$B$2:$B$7,3.9999,0,True) 9.9
Stepwise interpolation - outside X value range -1.0 0 True =LinearInterpolator($A$2:$A$7,$B$2:$B$7,-1.0,0,True) 0.8
6.0 1 True =LinearInterpolator($A$2:$A$7,$B$2:$B$7,6.0,1,True) 26
-4 2 True =LinearInterpolator($A$2:$A$7,$B$2:$B$7,-4.0,2,True) #NUM!

Note, constant values shown in the example equations above can of course be replaced by cell references, definitions, etc...

Error Messages When using the Linear Interpolation Function, it will return an error code in the following circumstances;

DescriptionCalcExcel
1.
  • there are a different number of X & Y values
  • if you only supply one point (one X and one Y value)
  • if you specify errNum to be returned if input x value is out of the known x range
-999 #Num
2. The specified cutoff is invalid, i.e. not in the range 0 to 2. -997#N/A

License Fee This "Tariser Tool" is licenced under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. There is no license fee for personal use of this tool. However, if you are using this software within software that you are developing and intend to sell, please e-mail me for details of the license fee.

How to Install Instructions for OpenOffice.org Calc (version 4) Will work for LibreOffice 3
Instructions for Microsoft Excel

How to Un-install Instructions for OpenOffice.org Calc (version 4) work for LibreOffice 3
Instructions for Microsoft Excel

Revision History
OpenOffice.org Calc
Rev Date Description
1.0 26-Aug-15 Initial Version Released, based on Rev 1.0 of my Excel version

Microsoft Excel
Rev Date Description
1.0 10-Nov-03 Initial Version Released

Software for Download
OS Ver. Spreadsheet Software
OS X 10 Apache OpenOffice™ 4 Calc tt03-002.ods  (11.7k)
Ubuntu 12.04 LibreOffice 3
Win 2000 Excel 97 TT03-002.xla  (37.9k)
Win XP Pro Excel 2003
Win 7 Excel 2007

Please let me know if you have used my Linear Interpolation Function, successfully or not, on any other Operating System and spreadsheet combination.

Source Code In accordance with the GNU General Public License the Microsoft Excel Add-in used to distribute this Tarsier Tool is not password protected allowing you to view and modify it if you require. You should review the GNU GPL to determine your rights to distribute this software and be informed that this software is distributed with NO WARRANTY.

Technical Support
Frequently Asked Questions Currently there are no FAQ for this tool. If you have a question, please e-mail it to me. Please ensure that you identify that the question is about my Linear Interpolation Function (TT03-002).

Bug Reports If you suspect a bug in this Tarsier Tool, before contacting me, please check the FAQs and Bug Reports to see if it has already been identified. If it hasn't, e-mail me a description. Please ensure you identify the Tarsier Tool, (Linear Interpolation Function TT03-002), the operating system and spreadsheet program in the e-mail and include as much detail as possible; including a simple example application is always helpful! but make sure it does not contain proprietary or confidential information.

Currently there are no reported bugs for this Tarsier Tool.

Further Information This section will be updated with links to information relating to the principles behind and the uses of this Tarsier Tool, as I become aware of them.

Back to Available Tarsier Tools

Copyright ©2003 Tarsier Software Solutions Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License
Creative Commons Licence