+ Reply to Thread
Results 1 to 9 of 9

Vlookup - + 2 conditions

  1. #1
    Registered User
    Join Date
    08-08-2007
    MS-Off Ver
    Excel 2010
    Posts
    53

    Vlookup - + 2 conditions

    Hi. looking to create a vlookup that will lookup the value obviously but also if blank display "NA", and also if the lookup value isn't in the look up list, display "error". currently i have the following.

    =IF(ISERROR(VLOOKUP(B2,LEGEND!A:B,2,FALSE)),"NA",VLOOKUP(B2,LEGEND!A:B,2,FALSE))
    Last edited by scabertrain; 03-04-2010 at 05:54 PM.

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

    Re: Vlookup - + 2 conditions

    Try:

    Please Login or Register  to view this content.
    Where there is a will there are many ways.

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

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

  3. #3
    Forum Moderator Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,826

    Re: Vlookup - + 2 conditions

    In NBVC's formula, for the first "NA", change that to "ERROR" to suit your worded request.

  4. #4
    Registered User
    Join Date
    08-08-2007
    MS-Off Ver
    Excel 2010
    Posts
    53

    Re: Vlookup - + 2 conditions

    tried the formula, however its giving me NA whether its blank or has a value that isn't present in the lookup listing. tried with "error" as the first option only and blank or diff value came out as error
    Last edited by scabertrain; 03-04-2010 at 03:29 PM.

  5. #5
    Forum Moderator Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,826

    Re: Vlookup - + 2 conditions

    This gave you errors:

    =IF(ISNA(VLOOKUP(B2,LEGEND!A:B,2,0)),"ERROR",IF(VLOOKUP(B2,LEGEND!A:B,2,0)="","NA",VLOOKUP(B2,LEGEND!A:B,2,0)))

    ?

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

    Re: Vlookup - + 2 conditions

    My formula should try the Vlookup. If the lookup value doesn't exist, you would get "NA" or "error" if you change it... if it is there and the result would be blank, then it would return "NA", otherwise it should return the relevant result.

    Can you show sample if it doesn't work that way?

  7. #7
    Registered User
    Join Date
    08-08-2007
    MS-Off Ver
    Excel 2010
    Posts
    53

    Re: Vlookup - + 2 conditions

    see attached
    Attached Files Attached Files

  8. #8
    Forum Moderator Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,826

    Re: Vlookup - + 2 conditions

    So do you want "NA" to appear if the cell in column B on sheet 'full data' is blank? We thought you meant if the return value from the VLOOKUP was a blank. If that's the case, try:

    =IF(B1="","NA",IF(ISNA(VLOOKUP(B1,LEGEND!A:B,2,0)),"ERROR",VLOOKUP(B1,LEGEND!A:B,2,0)))

    Fill down.

  9. #9
    Registered User
    Join Date
    08-08-2007
    MS-Off Ver
    Excel 2010
    Posts
    53

    Re: Vlookup - + 2 conditions

    That last one did it! thx for your help!!

+ 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