+ Reply to Thread
Results 1 to 14 of 14

Named Ranges that refer to all of workbook

  1. #1
    Registered User
    Join Date
    10-28-2011
    Location
    Ohio
    MS-Off Ver
    Excel 2010
    Posts
    78

    Named Ranges that refer to all of workbook

    I have a set of named ranges in a workbook. In the "refers to" dropdown, i selected workbook, which is what I want. In the actual formula for the range, it has just one of the tab names in the formula, leading me to believe that it really isn't referring to the entire workbook. Is there a way to change this?

    Ex. ='2012'!$A$2:INDEX(!$A:$A,COUNTA('2012'!$A:$A))
    my workbook has tabs for 2012, 2011, 2010 etc. I'd like the range to be the same for all of the workbook

  2. #2
    Forum Expert Whizbang's Avatar
    Join Date
    08-05-2009
    Location
    Greenville, NH
    MS-Off Ver
    2010
    Posts
    1,395

    Re: Named Ranges that refer to all of workbook

    I am not sure you are using the correct terms. The "Scope" is the one that has the dropdown to select Workbook, or individual sheets. This tells Excel where this named range is visible. Workbook means that you can use that name in a formula anywhere in the workbook. If you specify a sheet, then that named range is only available for use in that sheet.

    The refers to is the formula. The sheet name will automatically be entered into the formula. Maybe there is a way to remove the sheet name, but I don't know how. You can make the references relative (eg A1 instead of $A$1), which means that the formula will adjust depending on the cell using the named range. But, as far as I know, you can't make the sheet relative.

    Of course, now that I have said it can't be done, someone will post a way.

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

    Re: Named Ranges that refer to all of workbook

    I found a workaround.

    http://www.bettersolutions.com/excel...U822216331.htm

    The link above says to use Offset, but I found that all you need is the ! with no sheet name. =!A1 will refer to A1 on the active sheet.

    The below works just fine.
    =!$A$1:INDEX(!$A:$A,COUNTA(!$A:$A))

  4. #4
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: Named Ranges that refer to all of workbook

    Named ranges that are local to a sheet can be used in other sheets, you just need to prefix the range name with the sheet name.

    I would advise against using the !address syntax - it is extremely unreliable in my experience. It would be better to use INDIRECT in the name definition if you want it to refer to the same thing on each sheet.
    Good luck.

  5. #5
    Forum Expert Whizbang's Avatar
    Join Date
    08-05-2009
    Location
    Greenville, NH
    MS-Off Ver
    2010
    Posts
    1,395

    Re: Named Ranges that refer to all of workbook

    In what way is it unreliable?

  6. #6
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: Named Ranges that refer to all of workbook

    In terms of not updating. To be fair, it has been many years since I abandoned it so it may have been fixed by now.

  7. #7
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Named Ranges that refer to all of workbook

    Whizbang,

    Very nice. This fits into something I can use which has been bugging me. Thanks for sharing
    HTH
    Regards, Jeff

  8. #8
    Registered User
    Join Date
    10-28-2011
    Location
    Ohio
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Named Ranges that refer to all of workbook

    OK, you're right, i had the term wrong.

    What i was confused on is why when I select "scope" to be workbook, does the formula still have the sheet name in it. Ex. when I click on a tab that is 2011 in my workbook, my named ranges do not work on this sheet for some reason. Can i just re-enter them for each sheet? Just seems counter -productive.

    I will try the method below using the !

  9. #9
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: Named Ranges that refer to all of workbook

    See also Charley Kyd's comment about half-way down this page about crashing Excel. I am also 90+% certain I have seen Jan Karel Pieterse warn against using it too.

  10. #10
    Forum Expert Whizbang's Avatar
    Join Date
    08-05-2009
    Location
    Greenville, NH
    MS-Off Ver
    2010
    Posts
    1,395

    Re: Named Ranges that refer to all of workbook

    Well, I'll try it out in a few workbooks and scenarios and see how it behaves in 2010. So far, using the formula "=!$A$1:INDEX(!$A:$A,COUNTA(!$A:$A)) " in a named range called "Test", then using "=Counta(Test)", updates fine when I fill down the column.

    Also, this appears to work fine:
    Please Login or Register  to view this content.
    When I add sheets, both of the above continue to function fine.

    If you have any other resources commenting on the behavior of ![Ref], I would love to see them. In the mean time, I will use it where I feel appropriate, or can anticipate a likely use, and report back with any issues I have.

  11. #11
    Registered User
    Join Date
    10-28-2011
    Location
    Ohio
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Named Ranges that refer to all of workbook

    OK so here's a little background on my problem; I have a workbook i created, and it references another workbook on our network. Yesterday a new "upated" workbook got released that has 2012 info in it. All of my formulas now change in the book i created. I used the "change source" option on the edit links dialog box, and got the proper naming in all of my formulas now. Only problem is they are all showing #NAME errors. Now....when I change my name manager in the ref workbook to the !A2 structure, my errors go to #REF. Everything worked fine until I changed to the new ref workbook.

    I am almost certain my errors are coming from the naming structure for the columns. I have data that needs to pull from a 2011 tab in the ref book (so it is stored for record keeping), but I also need new data pulled from the 2012 tab. My formulas are all SUMPRODUCT.

    Here is an ex.
    =SUMPRODUCT(--('PURCHASE RECEIPTS FILE (2009_2012).2012.01.03.xlsx'!VENDOR_NAME="XXXX"),--('PURCHASE RECEIPTS FILE (2009_2012).2012.01.03.xlsx'!DATE>='DO NOT DELETE'!L$1),--('PURCHASE RECEIPTS FILE (2009_2012).2012.01.03.xlsx'!DATE<='DO NOT DELETE'!L$2),--('PURCHASE RECEIPTS FILE (2009_2012).2012.01.03.xlsx'!PO>=$E22),--('PURCHASE RECEIPTS FILE (2009_2012).2012.01.03.xlsx'!PART_NO.=$A22),'PURCHASE RECEIPTS FILE (2009_2012).2012.01.03.xlsx'!QTY)
    Last edited by dta1984; 01-06-2012 at 11:22 AM.

  12. #12
    Forum Expert Whizbang's Avatar
    Join Date
    08-05-2009
    Location
    Greenville, NH
    MS-Off Ver
    2010
    Posts
    1,395

    Re: Named Ranges that refer to all of workbook

    I do not know if the error is the same, but I recently helped someone who was trying to use Dynamic Named Ranges (using Index) in a SUMPRODUCT formula that referenced a closed workbook. For whatever reason, the Dynamic Named Range part didn't calculate and returned an error. Try changing the formula in the named range to a fixed range and see if your formula calculates.

  13. #13
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: Named Ranges that refer to all of workbook

    Re the !address issue, see the article here for instance. Up to you if you wish to use it.

    Edit: I just ran a quick test in 2010 and a recalculate does indeed cause all cells using the name to recalculate based on the active sheet, rather than the sheet they are on.
    Last edited by OnErrorGoto0; 01-06-2012 at 12:18 PM.

  14. #14
    Registered User
    Join Date
    10-28-2011
    Location
    Ohio
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Named Ranges that refer to all of workbook

    Quote Originally Posted by Whizbang View Post
    I do not know if the error is the same, but I recently helped someone who was trying to use Dynamic Named Ranges (using Index) in a SUMPRODUCT formula that referenced a closed workbook. For whatever reason, the Dynamic Named Range part didn't calculate and returned an error. Try changing the formula in the named range to a fixed range and see if your formula calculates.
    Hmm, so if I add in the sheet name to the formula after the file name, it works now. I also separated the name manager names and now have 1 for each tab instead of trying to do it by the whole workbook.

    ex. SUMPRODUCT(--('[PURCHASE RECEIPTS FILE (2009_2012).2012.01.03.xlsx]2011'!DATE>='DO NOT DELETE'!E$1)

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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