+ Reply to Thread
Results 1 to 4 of 4

Automatically adjust LINEST function to data set size with VBA code...

  1. #1
    Registered User
    Join Date
    06-11-2013
    Location
    Houston
    MS-Off Ver
    Excel 2010
    Posts
    7

    Automatically adjust LINEST function to data set size with VBA code...

    I have this quadratic LINEST function which analyzes a 20 year times series of free cash flows of Exxon Mobil. So the default data set size is n=20. However, many companies do not have 20 years worth of data so if I analyze a company with only 10 years of data (n=10), the LINEST function will return a #VALUE! error until I manually adjust the cell references. This is a hassle to say the least, especially when I have 10 of these LINEST functions to adjust as I don't only look at free cash flows. Below is the LINEST function as I have it now.

    How do I make this function automatically adjust to the data set size when it changes?

    {=TRANSPOSE(LINEST(B25:B44,$A$25:$A$44^{1,2}))}

    If n changes from 20 variables to just 10, assume the cell reference changes to B25:B34 and $A$25:$A$34. How do I make this happen without having to manually do it?

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

    Re: Automatically adjust LINEST function to data set size with VBA code...

    Use dynamic named ranges: http://www.contextures.com/xlNames01.html#Dynamic
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    06-11-2013
    Location
    Houston
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Automatically adjust LINEST function to data set size with VBA code...

    Never used dynamic name ranges before. Learned something new. I think this will solve my problem. Thanks for your help.

  4. #4
    Registered User
    Join Date
    06-11-2013
    Location
    Houston
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Automatically adjust LINEST function to data set size with VBA code...

    I have created the tables and dynamic names. How do I incorporate this into the formula? So far, it's still giving me a #VALUE! error. Here is the updated formula and screenshot. ss1 (2).png

    {=TRANSPOSE(LINEST(FCFE,Dates^{1,2}))}

+ 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. How to make LINEST function automatically adjust to data set size...
    By betapeg in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-29-2014, 03:06 PM
  2. [SOLVED] Userform code for .find function to adjust cell data
    By creekybones in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 09-20-2012, 04:55 AM
  3. Automatically adjust shape size based on value in a cell
    By jrv326s in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-09-2011, 12:41 PM
  4. [SOLVED] adjust automatically size margins
    By bebert in forum Excel General
    Replies: 0
    Last Post: 02-26-2006, 07:15 PM
  5. Adjust the size of cells automatically
    By Dajana in forum Excel General
    Replies: 1
    Last Post: 09-06-2005, 10:05 AM

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