Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Worksheet Functions / May 2008

Tip: Looking for answers? Try searching our database.

Building Non-Contiguous Arrays For Use With Linest

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Marston - 17 May 2008 19:28 GMT
Can anyone think of a simple way to accomplish this:

Goal - use the Linest function to create a regression against a series
of dynamic ranges.

Example:

            Column A       Column B          Column  C
Row 1    DATE            DOW                  VALUES

            1/1/08             =weekday(A2)     V1
             .                    .                         .
             .                    .                         .
             .                    .                         .
            12/31/08         .                         .

Using the Linest function, I'd like to create a regression that looks
at

n # of rows back (so flexible enough to include all data or from this
point in time to a limited number of days/weeks back)

Tuesdays Values = F ( Prior Monday, Prior Sunday, Prior Saturday,
Prior Friday, Prior Thur, Prior Wed, Prior Tues)

I understand the linest function and how to use Index to find all the
coefficients, rsquared, errors, etc. so no worries there.
But how can I create the ranges that pull the data that select only
data from a particular day of the week. Yes I know I could
take lots of real estate and repeat the values across multiple
columns. But that seems like such a waste since the values already
exist.

Any thoughts to this puzzle?
Domenic - 17 May 2008 21:34 GMT
To return an array of values (Column C) where the corresponding weekday
(Column B) is Thursday  (Weekday = 5)...

N(OFFSET(C2:C100,SMALL(IF(B2:B100=5,ROW(B2:B100)-ROW(B2)),ROW(INDIRECT("1
:"&COUNTIF(B2:B100,5)))),0,1))

To return an array of dates (Column A) where the corresponding weekday
(Column B) is Thursday (Weekday = 5)...

N(OFFSET(A2:A100,SMALL(IF(B2:B100=5,ROW(B2:B100)-ROW(B2)),ROW(INDIRECT("1
:"&COUNTIF(B2:B100,5)))),0,1))

Use these as your arguments for the LINEST function.

Hope this helps!

In article
<61635bb6-926b-483d-8358-463d10ea5a13@c19g2000prf.googlegroups.com>,

> Can anyone think of a simple way to accomplish this:
>
[quoted text clipped - 30 lines]
>
> Any thoughts to this puzzle?
Marston - 17 May 2008 22:15 GMT
> To return an array of values (Column C) where the corresponding weekday
> (Column B) is Thursday  (Weekday = 5)...
[quoted text clipped - 36 lines]
> > n # of rows back (so flexible enough to include all data or from this
> > point in time to a limited number of days/weeks back)
Thanks!!!!

> > Tuesdays Values = F ( Prior Monday, Prior Sunday, Prior Saturday,
> > Prior Friday, Prior Thur, Prior Wed, Prior Tues)
[quoted text clipped - 8 lines]
>
> > Any thoughts to this puzzle?
Marston - 19 May 2008 06:14 GMT
Something seems a bit off.
Shouldn't Small have an array and a k value as parameters? What's the
K value in this equation?

> > To return an array of values (Column C) where the corresponding weekday
> > (Column B) is Thursday  (Weekday = 5)...
[quoted text clipped - 38 lines]
>
> Thanks!!!!

> > > Tuesdays Values = F ( Prior Monday, Prior Sunday, Prior Saturday,
> > > Prior Friday, Prior Thur, Prior Wed, Prior Tues)
[quoted text clipped - 8 lines]
>
> > > Any thoughts to this puzzle?
Domenic - 19 May 2008 15:07 GMT
In article
<7e7dea90-ac1c-4167-98db-b734dc6acf5b@b5g2000pri.googlegroups.com>,

> Something seems a bit off.
> Shouldn't Small have an array and a k value as parameters? What's the
> K value in this equation?

The array for the SMALL function is...

    IF(B2:B100=5,ROW(B2:B100)-ROW(B2))

The K value for the SMALL function is actually an array of values...

    ROW(INDIRECT("1:"&COUNTIF(B2:B100,5)))

As I mentioned in my previous post, the two formulas I offered each
return an array of values and are used as the arguments for the LINEST
function.

For example, select two cells in a horizontal range, let's say E2:F2,
enter something like the following formula...

=LINEST(N(OFFSET(C2:C100,SMALL(IF(B2:B100=5,ROW(B2:B100)-
ROW(B2)),ROW(INDIRECT("1
:"&COUNTIF(B2:B100,5)))),0,1)),N(OFFSET(A2:A100,SMALL(IF(B2:B100=
5,ROW(B2:B100)-ROW(B2)),ROW(INDIRECT("1
:"&COUNTIF(B2:B100,5)))),0,1)))

...and then confirm with CONTROL+SHIFT+ENTER, not just ENTER.  If done
correctly, Excel will automatically place curly brackets around the
formula.

Does this help?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.