+ Reply to Thread
Results 1 to 4 of 4

LINEST range based on value of Column

  1. #1
    Registered User
    Join Date
    08-02-2012
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    5

    LINEST range based on value of Column

    Hi Guys,

    I'm currently doing a project at university and need to work out the coefficients of a 2nd order polynomial for the speed of a deceleration of a car.
    I have some data from a logger which was recorded at a sample rate of 1 second.
    I've fitted a Linest to this data, yet I have 65 cars of data to go through and thought making a macro would be the best way.

    At the moment I do a lot of manual editing before I can even get to this stage of running the Linest.

    The section of data which I use for the Linest, is determined by the clutch switch. The clutch switch value is contained in column C, when the clutch is engaged its 1 and disengaged is 0

    What I currently do is, at the first clutch value of 1 I start a new column(D) and write numbers increasing from 1 until the next clutch value of 0.

    Using the linest I use Column(D) as x values and vehicle speed - Column(A) as y.
    The row number begins at the first clutch value of 1 and stops at next clutch value of 0.

    I have attached an excel document with two tabs, the first showing the completed sheet with the extra column and the linest result, the second being the RAW data which I start with.

    If anyone could help to show me what formulas to use and help me on my way I would really appreciate it.

    Thanks
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: LINEST range based on value of Column

    Hi

    You may want to move the positions, but try this

    D5: =IF(C5=0,0,D4+1). Copy down to cover all your data
    G5: =MATCH(1,D:D,0)
    H5: =MATCH(MAX(D:D),D:D,0)
    G10:I10: =LINEST(INDIRECT("a" & G5 & ":A" & H5),INDIRECT("D" & G5 & ":D" & H5)^{1,2},,TRUE) (array entered)

    HTH

    rylo

  3. #3
    Registered User
    Join Date
    08-02-2012
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: LINEST range based on value of Column

    Hi Rylo,

    That is awesome, I turned it into a macro

    Please Login or Register  to view this content.
    Last edited by Cutter; 08-03-2012 at 07:48 AM. Reason: Added code tags

  4. #4
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: LINEST range based on value of Column

    @ MR.BIG.RED

    Welcome to the forum.

    Please notice that code tags have been added to your post(s). The forum rules require them so please keep that in mind and add them yourself whenever showing code in any of your future posts. To see instructions for applying them, click on the Forum Rules button at top of the page and read Rule #3.
    Thanks.

    Also, based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Finally, as a new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1