## interpolation in excell

## interpolation in excell

**dik**(visitor)

(OP)

I am looking for a function in excell that interpolates the value in one column to the one in another!

My problem looks like this

Disp wavelength

-76.0 1554

-77.5 1556

-79.1 1558

-80.8 1560

-82.5 1562

-84.3 1564

-86.2 1566

-88.2 1568

-90.2 1570

-92.4 1572

-94.7 1574

-97.1 1576

-99.6 1578

-102.2 1580

I am looking for a function that gives me wavelength as a function of dispersion for all dispersion values in the interval -70 to -102.

Does anyone have a solution to this

Jacob

My problem looks like this

Disp wavelength

-76.0 1554

-77.5 1556

-79.1 1558

-80.8 1560

-82.5 1562

-84.3 1564

-86.2 1566

-88.2 1568

-90.2 1570

-92.4 1572

-94.7 1574

-97.1 1576

-99.6 1578

-102.2 1580

I am looking for a function that gives me wavelength as a function of dispersion for all dispersion values in the interval -70 to -102.

Does anyone have a solution to this

Jacob

## RE: interpolation in excell

## RE: interpolation in excell

y = -0.0114x^2 + 34.782x - 26554

where y is dispersion and x is wavelength, in whatever units you used for your posting.

## RE: interpolation in excell

dik(visitor)I can't use the fit you suggested since I use more datapoints in the real dataset and a fit doesn't give values that are correct enough.

Thanks a lot for the help.

By the way is it possible to define a makro or function that will do the same and where I would just have to specify the dataset I want to interpolate and the value it should be interpolated at.

Jacob

## RE: interpolation in excell

you can rewrite the formulas in the worksheet as a VBA function and use it straight from the worksheet

Public Function INTER1(Xval As Double, X As Range, Y As Range)

Dim Nrow%

Nrow = Application.WorksheetFunction.Match(Xval, X, IIf(X(1) > X(X.Count), -1, 1))

INTER1 = Y(Nrow) + (Xval - X(Nrow)) / (X(Nrow + 1) - X(Nrow)) * (Y(Nrow + 1) - Y(Nrow))

End Function

## RE: interpolation in excell

dik(visitor)Jacob

## RE: interpolation in excell

Disp wavelength

-76 1554

-77.5 1556

-79.1 1558

-80.8 1560

-82.5 1562

-84.3 1564

-86.2 1566

-88.2 1568

-90.2 1570

-92.4 1572

-94.7 1574

-97.1 1576

-99.6 1578

-102.2 1580

-0.011158855 -2.972701541 1392.636695 #N/A

0.000305148 0.054237082 2.393678956 #N/A

0.99994583 0.066942506 #N/A #N/A

101527.5568 11 #N/A #N/A

=LINEST(D5:D18,C5:C18^{1,2},,TRUE)

The array shown above, with results, is an array formula to determine coefficients of 2nd degree polynominal. The equation listed is the array formula, where column D are y-values and column C are x-values. The first row of results are the coefficients (A2, A1, A0) for the 2nd degree polynominial.

FYI, Excel does have functions to determine coefficients of equations for a specified data. Please read the Online Help regarding the Linest Function. Not included in online help is method or technique to determine coefficients for various types of equations.

For this situation, data was plotted and a quadratic or 2-degree polynominial curve fit will suffice. If not 2-degree, then simply add a ",3" (without quotes) after the "2" in linest function for a 3rd degree polynominial.

Enter the linest function as an array formula. That means to: 1) highlight or select the range of cells (this case 4 rows x 4 columns) where formula is placed, 2) type in or use function wizard for linest function, using technique above, and 3) pressing ctrl+shift+enter. See above example. It is better to utilize the standard features of Excel than to writing functions to accomplish the same tasks.

I trust this helps.

## RE: interpolation in excell

Thanks for th insights of LINEST() function, I had no idea about its existence. The LINEST()

Returns an array that describes a straight line that best fit your data, calculated by usnig the least squares method.The VBA function in the my earlier reply simplyreturns linearly interpolated value between two data points.Two different goals...