+ Reply to Thread
Results 1 to 4 of 4

Refer indirectly to named range

  1. #1
    Registered User
    Join Date
    05-15-2009
    Location
    Nederland, CO
    MS-Off Ver
    Office 2000 & 2007
    Posts
    2

    Refer indirectly to named range

    Is it possible to refer indirectly to named ranges?

    I have a workbook with over 30 named ranges. On one of the sheets, I have a column listing the named ranges. The adjacent column uses a VLOOKUP to search those ranges. Unfortunately, I do not seem to be able to use a formula to refer to the named range.

    Say cell B3 contains the string, MOTtext (the name of the named range).
    if C3 contains
    =VLOOKUP(A3,MOTtext,5,true)
    it will work, but I'd like to be able to use something like
    =VLOOKUP(A3,B3,5,true) to refer to the name

    Any ideas? I've tried INDIRECT() and spelling out the range (Book.xls!MOTtext), but neither seems to work.

  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: Refer indirectly to named range

    Welcome to the forum.

    =VLOOKUP(A3, INDIRECT(B3), 5, TRUE)

    If the name in B3 has sheet scope on another worksheet, it should appear in B3 as, for example, Sheet2!MOTtext

    INDIRECT is volatile, so you'll want to use it sparingly.
    Last edited by shg; 05-15-2009 at 06:20 PM.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    05-15-2009
    Location
    Nederland, CO
    MS-Off Ver
    Office 2000 & 2007
    Posts
    2

    Re: Refer indirectly to named range

    Thank you. I had tried that, but referring to the full name Book.xls!MOTtext in another cell would not work. With you're prodding, I tried just MOTtext, and it worked. I must have done something wrong in the way that I specified the full range. Anyway, I can now use the formula in a column with 33 named ranges.

    It's important to me, because a FSO VBA routine deletes the old sheets and imports the (updated) data for those 33 ranges (all the CSV files in a folder), and creates the named ranges from the file names. This way, if they change (e.g., a 34th CSV file is added), I don't have to re-write everything.

    Thanks,
    jc the cg

  4. #4
    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: Refer indirectly to named range

    You're welcome. Would you please mark the thread as Solved? (See How To ... link in menu bar.)

+ 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