Filter function cell reference

rrussell

New Member
Joined
Nov 25, 2005
Messages
12
I have a block of data, each row has a different number of populated columns. Some cells were left blank, and some have more data than others. My problem is that the function I am using to analize this data doesn't like blank cells, is there a way to reference the cells to only use the populated fields under the full range of cells that could be filled in?
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Highlight the full range and give it a name. Use the named range in whatever formulas you're working with.
 
Upvote 0
I tried naming the cells and the function worked fine until it ran into a blank field. The function I am using is =LINEST(D15:K15,D14:K14) and some of the cells in that range are blank.
 
Upvote 0
rrussell said:
I tried naming the cells and the function worked fine until it ran into a blank field. The function I am using is =LINEST(D15:K15,D14:K14) and some of the cells in that range are blank.

=LINEST(IF(D15:K15="",0,D15:K15),IF(D14:K14="",0,D14:K14))

which you need to confirm with control+shift+enter, not just with enter.
 
Upvote 0
Aladin Akyurek said:
rrussell said:
I tried naming the cells and the function worked fine until it ran into a blank field. The function I am using is =LINEST(D15:K15,D14:K14) and some of the cells in that range are blank.

=LINEST(IF(D15:K15="",0,D15:K15),IF(D14:K14="",0,D14:K14))

which you need to confirm with control+shift+enter, not just with enter.

This does allow the function to still work, but the result is not correct because it uses the 0 value when it calculates the line.
I need it to skip the cell that is blank and only use populated cells. Thanks for your help.
 
Upvote 0
Try the following...

1) Define the following references...

Insert > Name > Define

Name: Array1

Refers to:

=SUBTOTAL(9,OFFSET(Sheet1!$D$15:$K$15,,SMALL(IF(Sheet1!$D$15:$K$15<>"",COLUMN(Sheet1!$D$15:$K$15)-COLUMN(Sheet1!$D$15)),ROW(INDIRECT("1:"&COUNTIF(Sheet1!$D$15:$K$15,">0")))),,1))

Click Add

Name: Array2

Refers to:

=SUBTOTAL(9,OFFSET(Sheet1!$D$14:$K$14,,SMALL(IF(Sheet1!$D$14:$K$14<>"",COLUMN(Sheet1!$D$14:$K$14)-COLUMN(Sheet1!$D$14)),ROW(INDIRECT("1:"&COUNTIF(Sheet1!$D$14:$K$14,">0")))),,1))

Click Ok

2) Then use the following formula...

=LINEST(Array1,Array2)

Change the sheet reference accordingly.

Hope this helps!
 
Upvote 0
rrussell said:
Aladin Akyurek said:
rrussell said:
I tried naming the cells and the function worked fine until it ran into a blank field. The function I am using is =LINEST(D15:K15,D14:K14) and some of the cells in that range are blank.

=LINEST(IF(D15:K15="",0,D15:K15),IF(D14:K14="",0,D14:K14))

which you need to confirm with control+shift+enter, not just with enter.

This does allow the function to still work, but the result is not correct because it uses the 0 value when it calculates the line.
I need it to skip the cell that is blank and only use populated cells. Thanks for your help.

Domenic's proposal would suffer under unequal number of empty cells. Hence what follows...
aaLINESTwithEmptyCells rrussell.xls
ABCDEFGHIJK
24-0.21429
3Range-1Range-2Pos
4131
5363
6264
7638
8   
9
10
11
12
13
141326
15346673
16
Sheet1


Formulas...

A2:

=MIN(COUNT(D14:K14),COUNT(D15:K15))

B2:

=LINEST(B4:INDEX(B4:B65536,A2),A4:INDEX(A4:A65536,A2))

A4, copied down:

=IF(N($C4),INDEX($D$14:$K$14,1,$C4),"")

B4, cpoied down:

=IF(N($C4),INDEX($D$15:$K$15,1,$C4),"")

C4:

=IF(ROW()-ROW(C$4)+1<=$A$2,SMALL(IF(ISNUMBER($D$14:$K$14)*ISNUMBER($D$15:$K$15),COLUMN($D$14:$K$14)-COLUMN($D$14)+1),ROW()-ROW(C$4)+1),"")

which must be confirmed with control+shift+enter and copied down.
 
Upvote 0
Domenic's method will work for my situation but when I tried using it in another worksheet I had a problem with the INDIRECT function. For some reason it does not like the text part "1:" (result is #value). Any idea why it was working in one worksheet, but not the other. The cells seam to be formated the same.
 
Upvote 0
rrussell said:
Domenic's method will work for my situation but when I tried using it in another worksheet I had a problem with the INDIRECT function. For some reason it does not like the text part "1:" (result is #value). Any idea why it was working in one worksheet, but not the other. The cells seam to be formated the same.

What I suggested will work for any situation.

BTW, the following would be more appropriate in A2:

=SUMPRODUCT(--ISNUMBER(D14:K14),--ISNUMBER(D15:K15))
 
Upvote 0

Forum statistics

Threads
1,225,769
Messages
6,186,926
Members
453,388
Latest member
MrBalls1983

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top