Help with a kind of interpolation

kcmuppet

Active Member
Joined
Nov 2, 2005
Messages
437
Office Version
  1. 365
Platform
  1. Windows
Hello,

In the example below, I'm calculating how much of a variable fall between each of 2 fixed points, which I think is a kind of interpolation (correct me if I'm wrong!).

Example: F3 = the difference between variable1 and the nearest next highest fixed point (fixed point 4) as a % of the difference between the two points that it falls between (fixed point 3 and fixed point 4)
Book2
ABCDEFGHIJ
1Fixed point 1Fixed point 2Fixed point 3Fixed point 4Fixed point 5Fixed point 6Fixed point 7
2variable1=96859095100105110115
3000.80.2000
sheet1
Cell Formulas
RangeFormula
D3D3=IF(variable1>=E$2,0,(E$2-variable1)/(E$2-D$2))
E3:I3E3=IF(OR(variable1<=D$2,variable1>=F$2),0,IF(variable1>E$2,(F$2-variable1)/(F$2-E$2),1-D3))
J3J3=IF(variable1<=I$2,0,1-I3)
Named Ranges
NameRefers ToCells
variable1=sheet1!$B$2D3:J3


While this solution works, it requires 3 different formulae in columns in the range (one in the middle and a different one at each end).

Is there a better way of doing this (where better = simpler formulae / single formula)?
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
You can add an AND to check if the cell to the upper right is blank.
Excel Formula:
AND(variable1>=E$2,E$2<>"")
The original equation in E3 worked for D3, but didn't work in J3. The AND I added just makes it fail the IF statement so it goes ahead with the calculation. If your number is lower than D2, then D3 always shows a 1. If it is greater than J2, then J3 will give you a number greater than 1. You could add conditional formatting to highlight these cases so it is obvious your variable1 is outside the interpolation range.

Book1
ABCDEFGHIJ
1Fixed point 1Fixed point 2Fixed point 3Fixed point 4Fixed point 5Fixed point 6Fixed point 7
2variable1=115859095100105110115
30000001
Sheet1
Cell Formulas
RangeFormula
D3:J3D3=IF(OR(variable1<=C$2,AND(variable1>=E$2,E$2<>"")),0,IF(variable1>D$2,(E$2-variable1)/(E$2-D$2),1-C3))
Named Ranges
NameRefers ToCells
variable1=Sheet1!$B$2D3:J3
 
Upvote 0
Solution

Forum statistics

Threads
1,215,086
Messages
6,123,043
Members
449,092
Latest member
ikke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top