+ Reply to Thread
Results 1 to 4 of 4

Code or formula help for the LinEst function

  1. #1
    Registered User
    Join Date
    10-03-2011
    Location
    Pensacola, Fl
    MS-Off Ver
    Excel 2007
    Posts
    8

    Code or formula help for the LinEst function

    So I have some spreadsheets made to do some caclulations on data I get from a possible set of 20 test runs. EX:
    Run Y X
    1 2 4.78
    .....
    20 6.23 5.09

    The worksheet works fine as long as there are the complete set of 20 runs. My problem is that on a given day I may do a few less runs and so I want a formula or VBA to be able to only account for the runs that I do on that day. As you can see from my attached worksheet the first page titled LINEAR works fine and doesn't use the LinEst function. So delete the last couple of runs (blue numbers) and press update numbers on the LINEAR worksheet and go to the subsequent worksheets (POLYNOMIAL, LOGARITHMIC, EXPONENTIAL, POWER) and you can see at the top of the pages the trendline coefficients that are highlighted that give me a #VALUE error when there are fewer runs. Any kind of help would be greatly appreciated (just a better formula or VBA)
    Attached Files Attached Files
    Last edited by joeyheaf; 10-03-2011 at 01:21 PM.

  2. #2
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,795

    Re: Code or formula help for the LinEst function

    Try this formula in POLYNOMIAL sheet E3

    =INDEX(LINEST(N(OFFSET(C7:C26,SMALL(IF(ISNUMBER(C7:C26),ROW(C7:C26)-ROW(C7)),ROW(INDIRECT("1:"&COUNT(C7:C26)))),,1)),N(OFFSET(B7:B26, SMALL(IF(ISNUMBER(B7:B26),ROW(B7:B26)-ROW(B7)),ROW(INDIRECT("1:"&COUNT(B7:B26)))),,1))^{1,2}),1)

    Needs to be confirmed with CTRL+SHIFT+ENTER

    Your other LINEST functions can be modified in a similar way

    This follows the suggestion here from Microsoft MVP Andrew Poulsom
    Audere est facere

  3. #3
    Registered User
    Join Date
    10-03-2011
    Location
    Pensacola, Fl
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Code or formula help for the LinEst function

    Ok I have the POLYNOMIAL sheet figured out and for logarithmic I am entering this but cant seem to come up with the right value

    =INDEX(LINEST(N(OFFSET(D7:D26,SMALL(IF(ISNUMBER(D7:D26),ROW(D7:D26)-ROW(D7)),ROW(INDIRECT("1:"&COUNT(D7:D26)))),,1)),LN(N(OFFSET(B7:B26, SMALL(IF(ISNUMBER(B7:B26),ROW(B7:B26)-ROW(B7)),ROW(INDIRECT("1:"&COUNT(B7:B26)))),,1)))^{1,2}),1)

    I added the LN function to where I thought is the right place but I am not getting the right value somehow
    Last edited by joeyheaf; 10-03-2011 at 11:48 AM. Reason: mistake

  4. #4
    Registered User
    Join Date
    10-03-2011
    Location
    Pensacola, Fl
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Code or formula help for the LinEst function

    I figured it out.....thank you for the help!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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