+ Reply to Thread
Results 1 to 4 of 4

Thread: Using Dynamic Named Range in Chart

  1. #1
    Registered User
    Join Date
    05-24-2011
    Location
    Raleigh, NC
    MS-Off Ver
    Excel 2007
    Posts
    4

    Question Using Dynamic Named Range in Chart

    In one tab, "Irrig Data," I have a data set spanning several years, with one entry per month. I have created a named range of the current year's data with dimensions 1 Column by N Rows, where N is the number of entries made so far this year. In other words, this range expands as I add new entries to the spreadsheet. Here is what I used to name the range:

    =OFFSET( INDIRECT(ADDRESS(7+12*FLOOR(COUNTA('Irrig Data'!$G$7:$G$66)/12,1),7,1,TRUE,"Irrig Data")),  0,  0,  COUNTA(OFFSET('Irrig Data'!$G$7,12*FLOOR(COUNTA('Irrig Data'!$G$7:$G$66)/12,1),0,12)) )
    The first parameter calculates a reference to the first entry of the current year (yes, my data start at the 7th row). The next two parameters are simply filler, since I don't need to adjust the range I am referencing. The last parameter counts how many entries have been made this year, which sets the number of rows to use for the range.

    When I try to use this range in a chart, I get the following error:

    A formula in this worksheet contains one or more invalid references. Verify that your formulas contain a valid path, workbook, range name, and cell reference.
    Any ideas on how I can get this range to show up in my graph by avoiding this error?

    Thanks!

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    MS 2007
    Posts
    5,372

    Re: Using Dynamic Named Range in Chart

    It might be the complexity of your formula (or something simplier like referencing the sheet in addition to the dynamic name?)

    I would get around it by referencing cells with formulas.
    For example, In Sheet2!A1
    =MATCH(Year(TODAY()),YEAR($G$7:$G$66),0) Entered as an ARRAY (CNTRL SHFT ENTER)
    Then your Defined name can be
    =OFFSET('Irig Data'!$G$7,Sheet2!$A$1-1,0,SUMPRODUCT(--(YEAR('Irig Data'!$G$7:$G$66)=YEAR(TODAY()))))
    Does that work for you?
    ChemistB
    My 2¢

    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

  3. #3
    Forum Guru Whizbang's Avatar
    Join Date
    08-05-2009
    Location
    Greenville, NH
    MS-Off Ver
    Excel 2010
    Posts
    1,249

  4. #4
    Registered User
    Join Date
    05-24-2011
    Location
    Raleigh, NC
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Using Dynamic Named Range in Chart

    Thanks guys, I got it to work by simplifying my formula. Since I'm trying to minimize my number of tabs, I ended up combining ChemistB's suggestion with the suggestion posted on Microsoft's website, referenced by Whizbang.

    You guys rock! Thank you so much, and sorry for the late response.

+ 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.2.0