I ended up writing some VBA code thanks @Lance Roberts
This code will actually loop through each row and column searching for blank entries, grabbing the upper and lower values and calculating that way.
The only problem is when the first row if data is blank.
The columns are hard coded as 10 due to laziness.
Sub SetAverages()
Dim lastrow As Integer, ncol As Integer, nrow As Integer
Dim secondvalrow As Integer, blankrows As Integer
Dim difference As Double, Increment As Double
Range("A65535").End(xlUp).Select
lastrow = ActiveCell.Row
For ncol = 2 To 10
For nrow = 2 To lastrow 'start after header row
If Cells(nrow + 1, ncol).Value = "" Then
secondvalrow = nrow + 1
Do Until Cells(secondvalrow, ncol).Value <> "" Or secondvalrow = lastrow + 1
secondvalrow = secondvalrow + 1
Loop
blankrows = secondvalrow - nrow
difference = Cells(secondvalrow, ncol).Value - Cells(nrow, ncol).Value
Increment = difference / blankrows
For i = nrow + 1 To secondvalrow - 1
Cells(i, ncol).Value = Cells(i - 1, ncol).Value + Increment
Next i
End If
Next nrow
Next ncol
End Sub
Are they always decreasing, as you go down, and always positive? – Lance Roberts – 2010-08-12T23:50:45.030
Will there be more than one gap in the numbers in a column? – Lance Roberts – 2010-08-12T23:58:01.563
Not always positive and could be any size gap. The time in the left most column will always be in increments of 10 mins and won't have any gaps. – Michael Galos – 2010-08-13T00:00:20.453
Wow, interpolation is tough when you don't want it to change the increment when you fill the values in, still working on it. – Lance Roberts – 2010-08-13T00:21:56.107
OK, while I can do the formula for the interpolation, it won't work because when the first cell fills in, it will change the increment on the following cells, and so on. Since I can't really store a variable (for the quantity of blank cells in the gap), I can't do it in a worksheet function. Let me know if you want a VBA solution. I'll be back tomorrow, just reference my name in a comment with an '@' sign. – Lance Roberts – 2010-08-13T00:28:38.830
I thought of one thing. If there is only one gap at a time per column (of any size) then you could put a row at the top that keeps the number of blank cells in that gap in it. It may have the same problem, but maybe not. Then it could be referenced by the interpolation formula. – Lance Roberts – 2010-08-13T00:35:45.283
OK, did up a VBA thing before I left. – Lance Roberts – 2010-08-13T01:13:52.247