vb to extrapolate data

men5j2s

Board Regular
Joined
Apr 26, 2016
Messages
59
Office Version
  1. 365
Platform
  1. Windows
I have 2 columns of data in a workbook and need to use VBA to extrapolate data.

I need to know Y for any value of X.

I have a range of known Ys and Xs (as below)

The trickier part here might be that I only want to consider part of the range to extrapolate (say the middle 6 values) - I then to be able to determine the difference between the extrapolated values and the ignored values. (compare Y at x=9 in the table vs extrapolated Y)

XY
53.2
5.53.5
63.7
6.53.8
74
7.54.2
84.3
8.54.5
93.2
9.52.8

<tbody>
</tbody>

If someone could get me going on this it would be amazing.. I'm really struggling.

The practical reason I'm doing this is to be able to determine the position at which a straight line curves off on a graph.
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Assuming your table of values starts in cells A2:B2 (cells A1:B1 are assumed to contain the X, Y header text) and the value you want to interpolate is in cell C1, then give this formula a try...

=(C1-VLOOKUP(C1,A2:B11,1,TRUE))*(VLOOKUP(C1+0.5,A2:B11,2,TRUE)-VLOOKUP(C1,A2:B11,2,TRUE))/(VLOOKUP(C1+0.5,A2:B11,1,TRUE)-VLOOKUP(C1,A2:B11,1,TRUE))+VLOOKUP(C1,A2:B11,2,TRUE)
 
Upvote 0

Forum statistics

Threads
1,215,004
Messages
6,122,659
Members
449,091
Latest member
peppernaut

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