+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    04-16-2009
    Location
    Kilkenny, Ireland.
    MS-Off Ver
    Excel 2010
    Posts
    36

    How to pass a Named Range from a cell as an argument to a formula

    Hi,

    I have the following formula which works fine in this form:
    Code:
    =vlookup(H2,GradingMatrix1,2)
    where GradingMatrix1 is a Named range.

    I have other named ranges GradingMatrix2, GradingMatrix3 that I would like to pass to the formula depending on user input.

    If a cell, say A2, contains a value "GradingMatrix1" and I convert the formula as follows:
    Code:
    =vlookup(H2,A2,2)
    then (unsurprisingly) the formula considers the array argument to be the single cell A2, and not the named range referred to in the cell contents.

    Maybe somebody out there could suggest a method of passing the range named within the cell as an argument to the formula?

    Many thanks
    B.
    Last edited by Orson100; 10-21-2009 at 10:42 AM.

  2. #2
    Forum Moderator NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003, 2007, 2010
    Posts
    31,163

    Re: How to pass a Named Range from a cell as an argument to a formula

    Try

    =vlookup(H2,Indirect("GradingMatrix"&A2),2)
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  3. #3
    Valued Forum Contributor jj72uk's Avatar
    Join Date
    03-22-2008
    Location
    Essex, England
    MS-Off Ver
    Work - Office 2000, Home - Office 2007E
    Posts
    360

    Re: How to pass a Named Range from a cell as an argument to a formula

    NBVC beat me to it... and his method is obviously better than mine..

    I was going along the lines of:

    =IF(A2=GradingMatrix1,VLOOKUP(H2,GradingMatrix1,2)),IF(A2=GradingMatrix2,VLOOKUP(H2,GradingMatrix2,2 )),IF(A2=GradingMatrix3,VLOOKUP(H2,GradingMatrix3,2),"")

  4. #4
    Registered User
    Join Date
    04-16-2009
    Location
    Kilkenny, Ireland.
    MS-Off Ver
    Excel 2010
    Posts
    36

    Re: How to pass a Named Range from a cell as an argument to a formula

    Great thanks NBVC, perfect solution and thanks for tip on parsing the named range ref!!

    Orson.
    Last edited by NBVC; 10-20-2009 at 11:00 AM. Reason: corrected spelling of my name

  5. #5
    Forum Moderator NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003, 2007, 2010
    Posts
    31,163

    Re: How to pass a Named Range from a cell as an argument to a formula

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

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