+ Reply to Thread
Results 1 to 8 of 8

Index Function with Named/Defined Ranges

  1. #1
    Registered User
    Join Date
    07-15-2010
    Location
    Ann Arbor
    MS-Off Ver
    Excel 2010
    Posts
    4

    Index Function with Named/Defined Ranges

    Pulling my hair out over this one...

    I have a master sheet (Tech Counts) that lists hospitals in column B and the workgroup each hospital belongs to in column A. There are several other columns that irrelevant to my problem.

    I created dynamic name ranges for each workgroup so as I add new hospitals to the workgroup I don't have to manually update the range. The "Index" sheet, pairs the workgroup number in "Tech Counts" with the appropriate defined name.

    In the "Report" sheet I set up validation in cell F5 to allow me to select a workgroup from the Index sheet. In cell A10, I have created a formula intended to use INDEX and INDIRECT to pull the first hospital in the workgroup I select. As you can see, I get a REF error. However if I simply type =INDEX(Detroit,1) I get Childrens Hospital of Michigan (the correct answer).

    Can some take a look and help me get the correct answer by using the dropdown?
    Attached Files Attached Files

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Index Function with Named/Defined Ranges

    I'm afraid INDIRECT won't work with Dynamic Named Ranges.

    You can circumvent by using an old XLM Call via a Name but this is in effect using a bit of VBA, eg:

    Please Login or Register  to view this content.
    You can then use

    Please Login or Register  to view this content.
    Hopefully that gives you an idea.

    The other alternative - if you have only a few names with which to work - would be to use a CHOOSE based construct thereby avoiding the Volatility (and need for XLM Call)

  3. #3
    Registered User
    Join Date
    07-15-2010
    Location
    Ann Arbor
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Index Function with Named/Defined Ranges

    I am really trying to avoid VBA as I am not too comfortable with it at this point. So index with only work with a named range not a dynamic range?

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Index Function with Named/Defined Ranges

    INDIRECT will only work with static ranges.

    In the prior post there's no code to worry about but the file would warrant being saved as .xlsm type given use of Evaluate in the _Workgroup named range.

    As mentioned, if you have only a handful of named ranges you can use a CHOOSE based construct rather than the XLM Evaluate call

    Please Login or Register  to view this content.
    The formula for A10 onwards remain as outlined in the prior post.

    The CHOOSE approach has added benefit of being non-volatile but has limited practicality pending number of named ranges in play.

  5. #5
    Registered User
    Join Date
    07-15-2010
    Location
    Ann Arbor
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Index Function with Named/Defined Ranges

    I will give the XLM Call a try. Could you instruct me a bit further on where the code you posted needs to be copied to?

  6. #6
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Index Function with Named/Defined Ranges

    Simply create a new Defined Name as outlined in post # 2 (ie via Name Manager as per normal).

  7. #7
    Valued Forum Contributor
    Join Date
    02-08-2010
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2007
    Posts
    122

    Re: Index Function with Named/Defined Ranges

    Review your file I think this can be resolve without INDIRECT. I added an auxiliary column and row in sheet Report, then the rest is just INDEX and MATCH.

    Review the attachment.

    Regards
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    07-15-2010
    Location
    Ann Arbor
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Index Function with Named/Defined Ranges

    All three solutions work GREAT!! Much obliged...

+ 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