+ Reply to Thread
Results 1 to 9 of 9

Multiple vlookup values based on text in another cell

  1. #1
    Registered User
    Join Date
    03-26-2012
    Location
    Austin, TX
    MS-Off Ver
    Excel 2010
    Posts
    17

    Multiple vlookup values based on text in another cell

    Hi,

    I am trying to perform a vlookup based on text in another cell. Depending on the text in that cell, the vlookup needs to use one of two lookup values.

    Please see attached example.

    HELPsample.xlsx

    Thank you in advance for your assistance.

  2. #2
    Forum Expert
    Join Date
    11-28-2012
    Location
    Guatemala
    MS-Off Ver
    Excel 2010
    Posts
    2,394

    Re: Multiple vlookup values based on text in another cell

    for line 2 this would return the desired result
    Please Login or Register  to view this content.

  3. #3
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,458

    Re: Multiple vlookup values based on text in another cell

    If there are only A,B,C type, use rcm's.
    If there are others D,E,F...
    =IF(D2="A",VLOOKUP(F2,Sheet2!$A$2:$F$4,6,0),IF(OR(D2="B",D2="C"),VLOOKUP(Sheet1!G2,Sheet2!$B$2:$F$4,5,0),""))
    Quang PT

  4. #4
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.83 (24031120))
    Posts
    8,731

    Re: Multiple vlookup values based on text in another cell

    you could just put an IF in place

    =IF( D2="A", vlookup , IF ( OR( D2="B", D2="C") , otherVlookup, "D is not A,B,C" ))

    not sure how your vlookup would work

    can you describe the vlookups

    you may need to use index/match
    Wayne
    if my assistance has helped, and only if you wish to , there is an "* Add Reputation" on the left hand side - you can add to my reputation here

    If you have a solution to your thread - Please mark your thread solved do the following: >
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  5. #5
    Registered User
    Join Date
    03-26-2012
    Location
    Austin, TX
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: Multiple vlookup values based on text in another cell

    This worked! However, it is returning the numbers as negatives. Any idea why this is happening?

    This is the formula in my spreadsheet:

    =-IF(P92="Clarity ID",VLOOKUP(AK92,'Proj FYTD'!A:J,10,0),IF(OR(P92="NPW",P92="Service Desk"),VLOOKUP('ER Assignments'!AX92,'Proj FYTD'!B:J,9,0),""""))

    Also, is there a way to return "0" instead of "#N/A"?

    THANK YOU!!!!!!

  6. #6
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.83 (24031120))
    Posts
    8,731

    Re: Multiple vlookup values based on text in another cell

    can you post the spreadsheet ?
    would only be negative if the values on column 10, or 9 are negative

  7. #7
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Multiple vlookup values based on text in another cell

    Quote Originally Posted by jmewebb View Post
    This worked! However, it is returning the numbers as negatives. Any idea why this is happening?

    This is the formula in my spreadsheet:

    =-IF(P92="Clarity ID",VLOOKUP(AK92,'Proj FYTD'!A:J,10,0),IF(OR(P92="NPW",P92="Service Desk"),VLOOKUP('ER Assignments'!AX92,'Proj FYTD'!B:J,9,0),""""))

    Also, is there a way to return "0" instead of "#N/A"?
    It may be returning a negative value because you're negating the result by including the minus sign at the beginning of the formula.

    See if this corrects that:

    =IF(P92="Clarity ID",VLOOKUP(AK92,'Proj FYTD'!A:J,10,0),IF(OR(P92={"NPW","Service Desk"}),VLOOKUP('ER Assignments'!AX92,'Proj FYTD'!B:J,9,0),""))

    To trap the #N/A error:

    =IFERROR(IF(P92="Clarity ID",VLOOKUP(AK92,'Proj FYTD'!A:J,10,0),IF(OR(P92={"NPW","Service Desk"}),VLOOKUP('ER Assignments'!AX92,'Proj FYTD'!B:J,9,0),"")),0)
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  8. #8
    Registered User
    Join Date
    03-26-2012
    Location
    Austin, TX
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: Multiple vlookup values based on text in another cell

    Thank you, Tony! This worked!

  9. #9
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Multiple vlookup values based on text in another cell

    You're welcome. Thanks for the feedback!


    If your question has been answered please mark the thread as being solved.

    In the menu bar above the very first post select Thread Tools>Mark this thread as solved.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] How to return multiple values to a single cell based on multiple criteria
    By lwallace in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-20-2014, 06:32 AM
  2. Replies: 1
    Last Post: 10-01-2013, 02:41 AM
  3. VLOOKUP to return values based on partial text
    By cartlidge_adrian in forum Excel General
    Replies: 5
    Last Post: 01-13-2012, 05:20 AM
  4. Replies: 1
    Last Post: 11-23-2011, 01:53 PM
  5. Replies: 12
    Last Post: 01-10-2008, 09:34 AM

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