+ Reply to Thread
Results 1 to 8 of 8

If statement with 2 vlookup ranges

  1. #1
    Forum Contributor
    Join Date
    02-03-2007
    Location
    Burleson, TX, USA
    MS-Off Ver
    2010
    Posts
    132

    If statement with 2 vlookup ranges

    Hello,

    My current formula is as follows:=IF(A4="","",VLOOKUP(A4,'Sched of Values'!$A$2:$D$65,2,)) and it works fine, but I am trying to add an extra set of parameters and have been unsuccessful. The formula I am trying is as follows: =IF(B5="*",VLOOKUP(B5,Vendors!A2:B1000,1, IF(A5="","",VLOOKUP(A5,'Sched of Values'!$A$2:$D$65,2,)))). This formula does not allow the original part to work (section that refers to A4) when it is false, the formula should force the VLOOKUP, instead regardless of the entries in A4 or B5 it only returns the word false.

    I would appreciate any help.

    Thanks,
    Mark

  2. #2
    Forum Contributor
    Join Date
    08-22-2011
    Location
    Texas, United States
    MS-Off Ver
    Excel 2007 and 2010
    Posts
    516

    Re: If statement with 2 vlookup ranges

    Try This

    =IF(B5="*",VLOOKUP(B5,Vendors!A2:B1000,1,FAlSE),IF(A5="","",VLOOKUP(A5,'Sched of Values'!$A$2:$D$65,2,FALSE),""))
    Regards,
    amotto

    If I helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)

  3. #3
    Forum Contributor
    Join Date
    08-22-2011
    Location
    Texas, United States
    MS-Off Ver
    Excel 2007 and 2010
    Posts
    516

    Re: If statement with 2 vlookup ranges

    My last "" is your else statement, if B5 is not * and A5 is not , then it will return "" if you want to return something just add it here.

  4. #4
    Forum Contributor
    Join Date
    02-03-2007
    Location
    Burleson, TX, USA
    MS-Off Ver
    2010
    Posts
    132

    Re: If statement with 2 vlookup ranges

    amotto - I got an error for too many arguements for the function. It then highlighted the last two quotes "". I deleted the quotes and the second if/vlookup referring to A5 worked, but the first portion referring to B5 still does not work. Any ideas?

    Thanks for the your help on this problem!

  5. #5
    Forum Contributor
    Join Date
    02-03-2007
    Location
    Burleson, TX, USA
    MS-Off Ver
    2010
    Posts
    132

    Re: If statement with 2 vlookup ranges

    I think the problem is the wildcard. Is there a way to trigger the if/vlookup if there is any text? I can't look for specific text as it could be multiple entries. Thanks in advance for any help!

    Mark

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,049

    Re: If statement with 2 vlookup ranges

    you can test for text with =istext()

    but looking at you're 2nd formula, i think you have left off a (

    =IF(B5="*",VLOOKUP(B5,Vendors!A2:B1000,1, IF(A5="","",VLOOKUP(A5,'Sched of Values'!$A$2:$D$65,2,))))
    should maybe be...
    =IF(B5="*",VLOOKUP(B5,Vendors!A2:B1000,1), IF(A5="","",VLOOKUP(A5,'Sched of Values'!$A$2:$D$65,2,)))
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  7. #7
    Forum Contributor
    Join Date
    08-22-2011
    Location
    Texas, United States
    MS-Off Ver
    Excel 2007 and 2010
    Posts
    516

    Re: If statement with 2 vlookup ranges

    you could do this

    if you were looking for text
    =IF(ISTEXT(B5),VLOOKUP(B5,Vendors!A2:B1000,1,FAlSE),IF(ISTEXT(A5),VLOOKUP(A5,'Sched of Values'!$A$2:$D$65,2,FALSE),"A5 and B5 were not text"))

  8. #8
    Forum Contributor
    Join Date
    02-03-2007
    Location
    Burleson, TX, USA
    MS-Off Ver
    2010
    Posts
    132

    Re: If statement with 2 vlookup ranges

    Thank you FDibbins and Amotto. I ended up using a form of Amottos. This worked great!! =IF(ISTEXT(B5),VLOOKUP(B5,Vendors!A2:B1000,2,FALSE),IF(A5<1000,VLOOKUP(A5,'Sched of Values'!$A$2:$D$65,2,FALSE)))

    Thanks again for the help!
    Mark

+ 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