I have been trying to interpolate between a column of X values (ascending, from 0 to +ve) and a column of Y values (descending, from +ve to -ve). I can't seem to get this forumla to work
X values= range X. Y values= range Y.
Cell A1 - input value for Y-location
Cell B1 - interpolated value of X
Cell C1 - index value (used to shorten interpolation formula)
Cell C1 formula checks the order of X-table and finds the index of closest to input value:
=MATCH(A1,Y,IF(ISNA(LOOKUP(A1,Y)),-1,1))
Cell B1 formula performs linear interpolation:
=INDEX(X,C1)+(A1-INDEX(Y,C1))/(INDEX(Y,C1+1)-INDEX(Y,C1))*(INDEX(X,C1+1)-INDEX(X,C1))
but it does work if I sort the Y values to ascending order, from -ve to +ve, so that the X values are now descending. I gather this is a pretty standard forumla used for interpolation. How can I alter it so I don't have to sort my Y values?
Thanks
Bookmarks