+ Reply to Thread
Results 1 to 3 of 3

INDEX based dynamic range creating errors with LINEST

  1. #1
    Registered User
    Join Date
    03-13-2018
    Location
    Sydney, Australia
    MS-Off Ver
    MS Office 2013
    Posts
    2

    INDEX based dynamic range creating errors with LINEST

    I've created a spreadsheet which uses named dynamic ranges created with an INDEX formula since they are non-volatile. For example =Sheet1!$D$5:INDEX(Sheet1!$D:$D,Sheet1!$B$8 + ROW(Sheet1!$D$5)-1)
    These dynamic ranges form the x and y value ranges in some LINEST formulas.

    Everything has worked well until I used a macro to modify some of the values contained in the dynamic ranges which are the inputs to the LINEST formula.
    For example say I have cell B3 with a value of 2 which is added to each of the cells in one of my dynamic ranges.
    If I type 3 in cell B3 and press enter everything works fine.
    However if I use a simple line of code in a macro such Range("B3").Value=3 then I get a #VALUE! error from the LINEST formula. All other formulas referring to the dynamic range behave normally.
    If I use a LINEST formula with hard coded input ranges or OFFSET based dynamic ranges then it works fine.

    I have attached a workbook which shows a simplified example of this issue.
    If you change the purple cell manually it works fine but if you use the button to change it then it causes an error.

    Can you tell me what's going on?

    Thanks
    Attached Files Attached Files
    Last edited by Ollie206; 05-17-2018 at 03:36 AM.

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,986

    Re: INDEX based dynamic range creating errors with LINEST

    Isn't the problem with your named ranges...

    Shouldn't

    =Sheet1!$D$5:INDEX(Sheet1!$D:$D,Sheet1!$B$8 + ROW(Sheet1!$D$5)-1)

    be

    =Sheet1!$D$5:INDEX(Sheet1!$D:$D,Sheet1!$B$8 + ROW(Sheet1!$B$5)-1)
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Registered User
    Join Date
    03-13-2018
    Location
    Sydney, Australia
    MS-Off Ver
    MS Office 2013
    Posts
    2

    Re: INDEX based dynamic range creating errors with LINEST

    Hi Glenn,

    Thanks for taking the time to look at my issue.

    I don't think the problem is with my named ranges.
    Whether it's $D$5 or $B$5 doesn't matter because it's taking the row which is still 5.
    I tried doing this anyway and the problem still exists.

    Ollie

+ 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. Replies: 6
    Last Post: 09-09-2014, 02:25 PM
  2. [SOLVED] Dynamic range errors
    By kevinjay1 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-20-2014, 07:38 AM
  3. Dynamic Range for LinEst
    By rags in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-25-2013, 06:18 PM
  4. [SOLVED] Creating a dynamic range based on a test
    By URod in forum Excel General
    Replies: 4
    Last Post: 02-15-2013, 04:19 AM
  5. [SOLVED] LINEST range based on value of Column
    By MR.BIG.RED in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-03-2012, 07:49 AM
  6. Replies: 4
    Last Post: 03-09-2012, 10:54 AM
  7. Using LINEST and TREND with a dynamic range
    By bn8959 in forum Excel General
    Replies: 0
    Last Post: 02-11-2012, 11:37 AM

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