Consulting

Results 1 to 9 of 9

Thread: Solved: LOOKUP, But Exact match

  1. #1

    Solved: LOOKUP, But Exact match

    I am using the following to auto fill a cell in worksheet. But it returns a nearest value if it cannot find an exact match

    =IF(B99>"",LOOKUP(B99,Lookuptab!D,Lookuptab!C:C),"")

    Is there any other way so that I can auto fill a "NOT FOUND" if an exact match is not found.

    In short I don't want the following feature of lookup

    If LOOKUP cannot find the lookup_value, it matches the largest value in lookup_vector that is less than or equal to lookup_value.

    Thanks
    Sreejith

  2. #2
    VBAX Mentor
    Joined
    Jun 2004
    Posts
    363
    Location
    Try this one:

    [VBA]=IF(B99>"",IF(ISNA(INDEX(Lookuptab!C:C,MATCH(B99,Lookuptab!D,0))),"Not Found",INDEX(Lookuptab!C:C,MATCH(B99,Lookuptab!D,0))),"")[/VBA]
    Last edited by mbarron; 02-26-2010 at 07:19 AM. Reason: error in formula

  3. #3
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Try

    =IF(B99>"",,IF(ISNUMBER(MATCH(B9,LookupTab!D:D,0)),INDEX(LookupTab!C:C,MATC H(B9,LookupTab!D:D,0)),"Not Found"),"")

    Watch that erroneous space that the forum introduced.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  4. #4
    VBAX Regular
    Joined
    Feb 2010
    Posts
    21
    Location

    Try this

    Hello

    Does this vlookup in an nested if statement help?

    =IF(ISNA(IF(B10<>"",VLOOKUP(B10,lookuptab!C126,2,FALSE),"")),"not found",VLOOKUP(B10,lookuptab!C126,2,FALSE))

    take an look at the file.

  5. #5
    mbarron/xld,
    Thanks very much. It worked. One minor problem with my spreadsheet is some of them got trailing spaces at the end in column B and hence showing up notfound. I use the space trimmer from ablebits . com. I am wondering if there is another solution.

    Thanks
    Sreejith

  6. #6
    VBAX Mentor
    Joined
    Jun 2004
    Posts
    363
    Location
    If you are talking about the B99 cell, you can use TRIM(B99) in the formula.

  7. #7
    VBAX Mentor
    Joined
    Jun 2004
    Posts
    363
    Location
    Quote Originally Posted by vicC
    Hello

    Does this vlookup in an nested if statement help?

    =IF(ISNA(IF(B10<>"",VLOOKUP(B10,lookuptab!C126,2,FALSE),"")),"not found",VLOOKUP(B10,lookuptab!C126,2,FALSE))

    take an look at the file.
    The OP is looking for a value in the D column and returning a value from the C column. VLOOKUP would not work in this situation.

  8. #8
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Why don't you post a workbook, I am not getting a good picture of the data.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  9. #9
    Thanks everyone. The following worked well
    =IF(B265>"",IF(ISNA(INDEX(Lookup!C:C,MATCH(TRIM(B265),Lookup!D,0))),"COVERAGE Not Found",INDEX(Lookup!C:C,MATCH(TRIM(B265),Lookup!D,0))),"")

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •