+ Reply to Thread
Results 1 to 7 of 7

Thread: Vlookup function too long

  1. #1
    Registered User
    Join Date
    03-09-2010
    Location
    los angeles
    MS-Off Ver
    Excel 2007
    Posts
    11

    Question Vlookup function too long

    Hi,
    I'm trying to vlookup eleven worksheets with various ranges. After typing in all the vlookups, the formula is too long to save. Any ideas?

    Eg:
    =IF(ISNA(VLOOKUP(A2,'2.0 X 1.5'!$A$4:$C$4,3,FALSE)),VLOOKUP(A2,'2.25 X 3.25'!$A$3:$C$14,3,FALSE),VLOOKUP(A2,'3 X 4'!$A$3:$C$12,3,FALSE))

    Couldn't go any further on the function.

    I appreciate any assistance.

    Thank you
    Last edited by NBVC; 03-10-2010 at 02:47 PM.

  2. #2
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,636

    Re: Vlookup function too long. Need Help

    If you can make all of the ranges the same sizes, even if they end up including blank rows, and make sure you use the largest range of the 11 sheets, then you can do this.

    List all 11 sheetnames in your summary sheet somewhere, then select that range and go to Formula tab and Define Name... Enter the word: Tabnames in the Name field.

    Then apply formula like:

    =VLOOKUP(A2,INDIRECT("'"&INDEX(TabNames,MATCH(TRUE,COUNTIF(INDIRECT("'"&TabNames&"'!A3:A14"),A2)>0,0))&"'!A3:C14"),3,FALSE)
    where 14 in the formula represents the last row of the largest lookup table in your 11 sheets.. and A3 represents top most cell in the same tables...
    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
    Registered User
    Join Date
    03-09-2010
    Location
    los angeles
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Vlookup function too long. Need Help

    I still can't get the formula to work.

    I've arranged every sheet so that the data will begin and end on the same lines including blanks, so the range fields are the same for each sheet.

    I've entered this formula, creating a new sheet called "MySheets" as a summary of all the worksheets.


    =VLOOKUP(A2,INDIRECT("'"&INDEX(MySheets,MATCH(TRUE,COUNTIF(INDIRECT("'"&MySheets&"'!A3:A14"),A2)>0,0 ))&"'!A4:C31"),3,FALSE)

    Do I need a create a "Name Manager" for the Mysheets?

    Thank you.

  4. #4
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,636

    Re: Vlookup function too long. Need Help

    Yes you need to create a Named Range called MySheets which points to the cells that contain the 11 sheetnames.

    and revise formula a bit:

    =VLOOKUP(A2,INDIRECT("'"&INDEX(MySheets,MATCH(TRUE,COUNTIF(INDIRECT("'"&MySheets&"'!A3:A31"),A2)>0,0 ))&"'!A4:C31"),3,FALSE)
    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.

  5. #5
    Registered User
    Join Date
    03-09-2010
    Location
    los angeles
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Vlookup function too long

    I've created a named range called MySheets pointing to the 11sheetnames Revised the formula as follows:

    =VLOOKUP(A2,INDIRECT("'"&INDEX(MySheets,MATCH(TRUE,COUNTIF(INDIRECT("'"&MySheets&"'!A2:A31"),A2)>0,0 ))&"'!A4:C31"),3,FALSE)

    Still can't get it to work. Copied and paste special value into cell A2 to verify I wasn't typing it incorrectly.

  6. #6
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,636

    Re: Vlookup function too long

    Did you confirm it with CTRL+SHIFT+ENTER keys together, not just ENTER?

    I forgot to mention that earlier
    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.

  7. #7
    Registered User
    Join Date
    03-09-2010
    Location
    los angeles
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Vlookup function too long

    Thank you so much. i greatly appreciate the help.

    Cheers

+ 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.2.0