+ Reply to Thread
Results 1 to 6 of 6

Problem with complex array formula for input to LINEST

  1. #1
    Registered User
    Join Date
    03-12-2019
    Location
    Loughborough, England
    MS-Off Ver
    10
    Posts
    3

    Problem with complex array formula for input to LINEST

    I'm a newbie to the forum so hi everyone

    My question concerns a problem/challenge I have to smooth a contingency table of data in two directions. An approach I'm researching involves splines.

    The tables may have missing data, and for ease of copying down, I want to accommodate edge effects.

    The task is to get two arrays to feed in to a LINEST array functions. The input arrays for x and y need to be manipulated so they themselves have no blank values. I've managed to get to a point pretty close to the input data using an array function of the form:

    =IFERROR(INDEX($B12:$B14,SMALL(IF(ISNUMBER(B12:B14),ROW(B$1:B$3)),{1;2})),"") function [1]

    The image shows this nicely. Each function return an array of length 3 - my spline. Blanks go to the bottom. However I need to feed these arrays in to LINEST, by shortening the arrays to omit the blanks. So it would seem I simply need to extract a sub-array, of length equal to the number of numeric values whicj I can always no using a simple count on the input cell range.

    I can do this if the array is cast on to the worksheet using, for example: =INDEX(K13:K15,{1;2}), will get me the top two rows where K13:K15 contains the values returned from the function [1].

    However, none of this works when I then insert my formula in to LINEST. Oddly I get no error, just zero for m.

    So, how do I get I get an array, cropped to the length of populated values, in a form in which LINEST is happy with?


    Thanks in advance

    Summary

    The image shows my array formula working as intended, finding only the cells with y values, correctly matched to the x value. I now need to get a x and y arrays of length equal to the number of y values, and feed these in to LINEST.

    Capture.PNG

  2. #2
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,704

    Re: Problem with complex array formula for input to LINEST

    the below would give you an array of 1 to n where n determined by count

    Formula: copy to clipboard
    Please Login or Register  to view this content.

    thereafter I'm afraid I'm a little lost ... you might need to post a sample file with expected results, manually derived, or wait for someone with sufficient "smarts".
    Last edited by XLent; 03-12-2019 at 08:26 AM. Reason: typo in narrative...

  3. #3
    Registered User
    Join Date
    03-12-2019
    Location
    Loughborough, England
    MS-Off Ver
    10
    Posts
    3

    Re: Problem with complex array formula for input to LINEST

    Thanks XLent, that is indeed a useful to get an array of the required length

    I'll battle on but further thoughts on the original problem welcome

  4. #4
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Problem with complex array formula for input to LINEST

    Hi,

    Try my post here:

    https://excelxor.com/2016/02/16/crit...-logest-trend/

    Give me a shout if you have difficult adapting it to your circumstances.

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  5. #5
    Registered User
    Join Date
    03-12-2019
    Location
    Loughborough, England
    MS-Off Ver
    10
    Posts
    3

    Re: Problem with complex array formula for input to LINEST

    Hi XOR LX

    thanks for your response; your detailed exposition of solving the problem was like music to my ears. I'd seen some references to using mode.mult to get an array of numeric values to index but been unable to follow them and your article was so crystal clear so many many thanks.

    For others interested, my need was to omit non-numerics on the y value. Here's my solution using XOR LIs download on the problem of criteria with LINEST and other statistical functions

    Firstly, I inserted a new column B2:B11 with x values {12,49,70,29,10,96,9,36,34,39}

    Cell J3 (ignoring non-numerics):

    =LINEST(INDEX(C:C,N(IF(1,MODE.MULT(IF(ISNUMBER(C2:C11)=TRUE,{1,1}*ROW(C2:C11)))))))

    Cell K3:L3 ignoring x and y values with no corresponding y (ensuring x,y's are paired)

    =LINEST(INDEX(C:C,N(IF(1,MODE.MULT(IF(ISNUMBER(C2:C11)=TRUE,{1,1}*ROW(C2:C11)))))),INDEX(B:B,N(IF(1,MODE.MULT(IF(ISNUMBER(C2:C11)=TRUE,{1,1}*ROW(B2:B11)))))))

    Note if were possible to get a y with no x it will fail.


    Capture.PNG
    Last edited by Wattcommunity; 03-14-2019 at 08:15 AM. Reason: typos

  6. #6
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Problem with complex array formula for input to LINEST

    Glad to hear it!

    Cheers

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. VBA array input array output problem
    By financerelated in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-29-2017, 04:07 PM
  2. [SOLVED] Using IF-based array formula within INDEX(LINEST()) formula
    By thalsted in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 09-25-2015, 03:40 PM
  3. [SOLVED] Complex Array Formula
    By Ignatius107 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 04-23-2013, 09:27 AM
  4. Replace hard coded array in formula with link to input array
    By David Brown in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 01-08-2011, 07:45 AM
  5. LINEST array formula not working
    By mouseclicker in forum Excel General
    Replies: 2
    Last Post: 10-12-2010, 08:29 PM
  6. Using FormulaR1C1 to input complex formula into cell
    By kevnin in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-09-2008, 07:51 PM
  7. Complex nested array formula problem and challenge
    By PeterWilliams in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-26-2007, 10:34 PM

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