+ Reply to Thread
Results 1 to 7 of 7

Refer to named range in another file

  1. #1
    Forum Contributor Bob@Sun's Avatar
    Join Date
    09-03-2009
    Location
    Montuak, Usa
    MS-Off Ver
    Excel 2007
    Posts
    438

    Refer to named range in another file

    Hello,

    I am trying to build something like a data base and then calculate result in a separate workbook.
    Having one file with the data for each month I am assigning named ranges for Column A - "Name" and Column B - "Items".
    I another file I need to use the Sumproduct function to count items for each name.
    Is it possible to make the reference dynamic so my Master file to refer to the named ranges of the open file?
    Example: If I open the file for Jan the Master file to refer to named range "Name" and "Items" of this file, If open the file for March to refer to the named ranges of this file.

    Thanks!

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Refer to named range in another file

    Hi Bob. As long as you're going to be opening a specific file each time, you could put the name of that workbook in your main workbook in a cell, then use that cell to construct an INDIRECT() reference inside your SUMPRODUCT() formulas, or COUNTIF() which sounds like it might be a better choice.

    If A1 held the workbook name you want to use at any given moment, in the same workbook create a named range NAMES with an indirect() reference that refers to:
    =INDIRECT("[" & 'Main Workbook'!$A$1 & "]Sheet1!$A$1:$A$100")

    Then you should able to use a simple COUNTIF(Names, "Name1") to count all the times "Name1" appears in the range defined.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Contributor Bob@Sun's Avatar
    Join Date
    09-03-2009
    Location
    Montuak, Usa
    MS-Off Ver
    Excel 2007
    Posts
    438

    Re: Refer to named range in another file

    I can't make it to work

  4. #4
    Forum Contributor Bob@Sun's Avatar
    Join Date
    09-03-2009
    Location
    Montuak, Usa
    MS-Off Ver
    Excel 2007
    Posts
    438

    Re: Refer to named range in another file

    =OFFSET('Sheet - 1'!$E$2,0,0,COUNTA('Sheet - 1'!$E$2:$E$65536),1)

    That is the range I need to define in the data base files.
    How do I incorporate it with the Indirect function?

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Refer to named range in another file

    Why does it need to be dynamic? A lot of plumbing. I only use dynamic formulas to keep data validation lists tidy, ranges for countif() formulas don't need that.

  6. #6
    Forum Contributor Bob@Sun's Avatar
    Join Date
    09-03-2009
    Location
    Montuak, Usa
    MS-Off Ver
    Excel 2007
    Posts
    438

    Re: Refer to named range in another file

    Well that is what I need. The Countif function was only for an example. My file holds much more complicated formulas.

  7. #7
    Forum Contributor Bob@Sun's Avatar
    Join Date
    09-03-2009
    Location
    Montuak, Usa
    MS-Off Ver
    Excel 2007
    Posts
    438

    Re: Refer to named range in another file

    Any ideas?

+ 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