I am using a forumla on filtered data - how to select only the data that is visible?

cdossenb

New Member
Joined
Jun 1, 2011
Messages
3
I have a 5000 line table I am filtering by a few columns, and I'd like to calculate an exponential trendline value.

=INDEX(LINEST(LN(R1059:R1167),W1059:W1167),1)

But I actually don't want all the values from R1059 to R1167 - I want to select only the displayed values (R1059, R1068, R1077, etc). Is there a way to select only display values to use in a formula? The problem is it would be a lot of manual work to select them all - there are 50 or so instances I would have to select 13 manual values.


I am using Excel 2007 on XP.
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Hello cdossenb, welcome to MrExcel,

Domenic suggests a solution here for LINEST with a condition - you could amend that so that the condition is that the rows be visible (after filtering)....so that would make it:

=INDEX(LINEST(LN(N(OFFSET(R1059:R1167,SMALL(IF(SUBTOTAL(2,OFFSET(R1059:R1167,ROW(R1059:R1167)-ROW(R1059),0)),ROW(R1059:R1167)-ROW(R1059)),ROW(INDIRECT("1:"&SUBTOTAL(2,R1059:R1167)))),0,1))),N(OFFSET(W1059:W1167,SMALL(IF(SUBTOTAL(2,OFFSET(W1059:W1167,ROW(W1059:W1167)-ROW(W1059),0)),ROW(W1059:W1167)-ROW(W1059)),ROW(INDIRECT("1:"&SUBTOTAL(2,W1059:W1167)))),0,1))),1)

confirmed with CTRL+SHIFT+ENTER
 
Upvote 0
Thank you both for your quick replies!!

I fear I not quite understand how to implement your suggestions - I think I will go with just copying the range and pasting somewhere else on the sheet. It is sort of slow and manual, but that's how it goes sometimes.
 
Upvote 0
In addition, this array formula should handle filtered data:

=SLOPE(LN(R1059:R1167),IF(SUBTOTAL(2,OFFSET(W1059,ROW(W1059:W1167)-ROW(W1059),0)),W1059:W1167))

entered with CTRL+SHIFT+ENTER. Substitute SLOPE for INTERCEPT, RSQ, or STEYX for related LINEST stats, or use FORECAST in place of TREND.

You can check values against the exponential chart trendline values which also allows for filtered data. The exponent should match the slope and the log of the coefficient should match the intercept.
 
Upvote 0
Thanks Lori M!
I think I'm almost there!

To get

Equation: y = c *e ^(b * x)
b: =INDEX(LINEST(LN(y),x),1)

I used your wonderful LINESTgap function (with a little help from the 'How to use Arrays' you posted - you are awesome!), but I tried changing
</pre>LinestGap = WorksheetFunction.LinEst(Ln(YA2), XA2, Const0, Stats)

And then I tried in a separate cell
=INDEX(V3847,1)

(V3847 is the test cell)

But the value isn't correct. Something is wrong. Any ideas where to add the LN?
 
Upvote 0
Try the likes of:
Excel Workbook
ABCDE
1xy0.0591120.059112
44491
54461
85421
11648.51
12641.81
137541
14747.21
15744.81
16848.21
Sheet


where the formula in E1 (Array-Entered this last essential) is more complex but doesn't need the helper column C which D1 (also array-entered) uses. Use the same technique for other functions.
 
Upvote 0

Forum statistics

Threads
1,215,793
Messages
6,126,936
Members
449,349
Latest member
Omer Lutfu Neziroglu

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