# interpolate missing values [closed]

I have a four-column table where the 1st column is the independent variable. Each other column has several values missing. Can I ask Calc to interpolate them?

First time here? Check out the FAQ!

interpolate missing values [closed]

close date 2015-10-15 15:04:38.277519

add a comment

0

```
SUB INTERPOLATE
DIM FY&, S AS OBJECT, V#, PY&, FT#, DT#, PV#, T#, C&, L&
LET C& = &O3
SET S = THISCOMPONENT. SHEETS (&O4)
LET FY& = &O1
LET L& = C& + &O4
DO
REM @SCAN
LET FT# = S. GETCELLBYPOSITION (&O0, FY&). VALUE#
IF FT# = &O0 THEN EXIT DO
LET V# = S. GETCELLBYPOSITION (C&, FY&). VALUE#
IF V# THEN
REM ?HASTEMP Y
LET S. GETCELLBYPOSITION (L&, FY&). VALUE# = V#
IF PY& THEN
REM ?NOTFIRST Y
LET PV# = S. GETCELLBYPOSITION (C&, PY&). VALUE#
LET DT# = FT# - S. GETCELLBYPOSITION (&O0, PY&). VALUE#
LET PY& = PY& + &O1
DO WHILE PY& < FY&
REM @BLANKS
LET T# = FT# - S. GETCELLBYPOSITION (&O0, PY&). VALUE#
LET S. GETCELLBYPOSITION (L&, PY&). VALUE# = (PV# * T# + V# * (DT# - T#)) / DT#
LET PY& = PY& + &O1
LOOP
REM @BLANKS X
ELSE
REM ?NOTFIRST N
LET PY& = FY&
END IF
REM ?NOTFIRST
END IF
REM ?HASTEMP
LET FY& = FY& + &O1
LOOP
REM @SCAN X
MSGBOX FY&
END SUB
REM !INTERPOLATE X
```

Assumptions:

- The table to interpolate is in sheet #5.
- The independent column is A and data start at row 2.
- The code below interpolates column D, change C& to interpolate another column.
- Change L& to put the results further to the right.

Asked: ** 2012-03-09 14:56:34 +0200 **

Seen: **2,642 times**

Last updated: **Mar 09 '12**

Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.