+ Reply to Thread
Results 1 to 7 of 7

Trendline coefficient extraction code

  1. #1
    Registered User
    Join Date
    06-16-2010
    Location
    Bournemouth, England
    MS-Off Ver
    Excel 2003
    Posts
    6

    Trendline coefficient extraction code

    Hello

    I recently found the code below posted in a thread and have been trying to make use of it as it does exactly what I needed to achieve.

    The code works beautifully (I am using the TLcoef function) with just one issue. When I save, close and then return to the workbook, the error message '"#Err: No trendline matches the specified parameters" appears where the array should be, even though nothing has changed except for going out and in again. Also (strangely) I can no longer select any cells on the sheet.

    Does anybody have any idea why this may be happening and what I can do about it?

    Thanks in advance

    Josie

    (code in next thread)
    Last edited by JosieB; 06-17-2010 at 07:06 AM.

  2. #2
    Registered User
    Join Date
    06-16-2010
    Location
    Bournemouth, England
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Trendline coefficient extraction code

    Please Login or Register  to view this content.
    Last edited by pike; 06-16-2010 at 06:15 AM.

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Trendline coefficient extraction code

    Why not just use LINEST or LOGEST to get the trendline coefficients on the worksheet directly?
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Registered User
    Join Date
    06-16-2010
    Location
    Bournemouth, England
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Trendline coefficient extraction code

    Hi there

    My graphs contain polynomial trendlines. My understanding is that LINEST can only provide coefficients for a linear relationship but not for a polynomial. Is that correct?

    Thanks

    Josie

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Trendline coefficient extraction code

    LINEST will do linear, polynomial, exponential, and power series.


    {=LINEST(y, x^{1,2,3})} for example, returns the coefficients of a cubic polynomial.
    Last edited by shg; 06-16-2010 at 12:57 PM.

  6. #6
    Registered User
    Join Date
    06-16-2010
    Location
    Bournemouth, England
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Trendline coefficient extraction code

    Fantastic, thanks. I didn't know that!

    As it happens, I found another way around the problem, in case anybody is interested. I used a macro to call the function and assigned that macro to a command button rather than actually entering the function array in the cells and it works fine.

    Please Login or Register  to view this content.
    LINEST is probably neater though

    Thanks!

  7. #7
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Trendline coefficient extraction code

    Good job. No need to select, though:
    Please Login or Register  to view this content.

+ 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