Enter this as an array formula (Ctrl+Shift+Enter):
Code:=LINEST(IF(A3:A54="",A3,A3:A54),IF(B3:B54="",B3,B3:B543))
I have been trying to use LINEST for the analysis of a large sets of data but have just noticed that this function does not allow for empty cells in the data set. Apart from the tredious possibility of removing the blank cells (which is not really possible for the large quantity of data involved) does anybody have any suggestions?
I have tried using the following but have not had any success:
=LINEST(IF(A3:A54=0,"",A3:A54),IF(B3:B54=0,"",B3:B54),,TRUE)
=LINEST(IF(ISNUMBER(A3:A54),A3:A54,""),IF(ISNUMBER(B3:B54),B3:B54,""))
I do not want the formula to take the empty cells as being 0 but to exclude them from the calculation.
All help would be greatly appreciated.
Enter this as an array formula (Ctrl+Shift+Enter):
Code:=LINEST(IF(A3:A54="",A3,A3:A54),IF(B3:B54="",B3,B3:B543))
Gladly helping those who are willing to learn and gladly learning from those who are willing to teach.
Another possibility:
=LINEST(N(OFFSET(A3:A54,SMALL(IF(ISNUMBER(A3:A54),ROW(A3:A54)-ROW(A3)),ROW(INDIRECT("1:"&COUNT(A3:A54)))),,1)),N(OFFSET(B3:B54,SMALL(IF(ISNUMBER(B3:B54),ROW(B3:B54)-ROW(B3)),ROW(INDIRECT("1:"&COUNT(B3:B54)))),,1)))
also with Ctrl+Shift+Enter.
Microsoft MVP - Excel
Gladly helping those who are willing to learn and gladly learning from those who are willing to teach.
Thank you both very much for the rapid replies.
However these solutions do not seem to be working, it appears that Phoxs suggestion has the problem of replacing the empty cell with the value in cell A3 ('value if TRUE' in logical test).
Mr Poulsoms suggestion appears close (even though its complexity baffles me, I don't really understand it), but only appears to work if the cells for corresponding x and y values are BOTH empty.
In my case the X valuse are constant while the Y values vary, with the Y values frequently containing empty cells or indeed 0.
I am surprised that EXCEL don't seem to have a means for the function to ignore empty cellls or those containing 0 when carrying out a LINEST calculation.
I'm actually not too sure if it is possible to regulate this problem with EXCEL.
Thank you.
Stick around Tony. I'm sure Andrew can alter his formula to accomodate. I doubt he expected only one of the values would be blank.
Gladly helping those who are willing to learn and gladly learning from those who are willing to teach.
Andrew's formula can be modified as follows...
...confirmed with CONTROL+SHIFT+ENTER. If, however, the so-called empty cells actually contain formula blanks (""), the formula would need to be modified further.Code:=LINEST(N(OFFSET(A3:A54,SMALL(IF(B3:B54<>0,ROW(B3:B54)-ROW(B3)), ROW(INDIRECT("1:"&COUNT(B3:B54)))),,1)),N(OFFSET(B3:B54, SMALL(IF(B3:B54<>0,ROW(B3:B54)-ROW(B3)),ROW(INDIRECT("1:"& COUNT(B3:B54)))),,1)))
Edit: Actually, I guess it should be the other way around...
Code:=LINEST(N(OFFSET(A3:A54,SMALL(IF(A3:A54<>0,ROW(A3:A54)-ROW(A3)), ROW(INDIRECT("1:"&COUNT(A3:A54)))),,1)),N(OFFSET(B3:B54, SMALL(IF(A3:A54<>0,ROW(A3:A54)-ROW(A3)),ROW(INDIRECT("1:"& COUNT(A3:A54)))),,1)))
Last edited by Domenic; Jun 5th, 2009 at 01:24 PM.
I was able to work Domenic's formula if the cell values were vertically placed. I tried to modified the formula(see below) for cell values placed horizontally, however I keep getting "#Value!". I'm not sure if my formula is correctly modified.
Code:=LINEST(N(OFFSET(B15:K15,,SMALL(IF(B15:K15<>0,COLUMN(B15:K15)-COLUMN(B15)), COLUMN(INDIRECT("1:"&COUNT(B15:K15)))),1,)),N(OFFSET(B16:K16,, SMALL(IF(B15:K15<>0,COLUMN(B15:K15)-COLUMN(B15)),COLUMN(INDIRECT("1:"& COUNT(B15:K15)))),1,)))
Some of the ROW functions need to remain as ROW, even for horizontal ranges of data - try this version
=LINEST(N(OFFSET(B15:K15,,SMALL(IF(B15:K15<>0,COLUMN(B15:K15)-COLUMN(B15)),ROW(INDIRECT("1:"&COUNT(B15:K15)))),1,)),N(OFFSET(B16:K16,,SMALL(IF(B15:K15<>0,COLUMN(B15:K15)-COLUMN(B15)),ROW(INDIRECT("1:"&COUNT(B15:K15)))),1,)))
Perfect.... essentially I am trying to calculate a multiple regression, with the "y" variable having blanks or "-" at times. If the "y" variables has blanks or "-" the regression ignores the calculation for that paired series. I did an independent multiple regression compared to my formula and I get different answers.
X variables : BQ11:DX12
Y variables : BQ18:DX18
ctrl+shift+enter=INDEX(LINEST(N(OFFSET(BQ18:DX18,,SMALL(IF(BQ18:DX18<>0,COLUMN(BQ18:DX18)-COLUMN(BQ18)),ROW(INDIRECT("1:"&COUNT(BQ18:DX18)))),1,)),N(OFFSET(BQ11:DX12,,SMALL(IF(BQ18:DX18<>0,COLUMN(BQ18:DX18)-COLUMN(BQ18)),ROW(INDIRECT("1:"&COUNT(BQ18:DX18)))),1,)),TRUE,TRUE),1,1)+INDEX(LINEST(N(OFFSET(BQ18:DX18,,SMALL(IF(BQ18:DX18<>0,COLUMN(BQ18:DX18)-COLUMN(BQ18)),ROW(INDIRECT("1:"&COUNT(BQ18:DX18)))),1,)),N(OFFSET(BQ11:DX12,,SMALL(IF(BQ18:DX18<>0,COLUMN(BQ18:DX18)-COLUMN(BQ18)),ROW(INDIRECT("1:"&COUNT(BQ18:DX18)))),1,)),TRUE,TRUE),1,2)
Like this thread? Share it with others