Results 1 to 3 of 3

Thread: if iserror

  1. #1
    3 Star Lounger
    Join Date
    Oct 2004
    Location
    Houston, Texas, USA
    Posts
    242
    Thanks
    1
    Thanked 0 Times in 0 Posts
    With a normal vlookup I can use if iserror to avoid #N/A:
    =IF(ISERROR(VLOOKUP(F2,nvl,2,FALSE)),"Not found",VLOOKUP(F2,nvl,2))

    However, when I try to do a left lookup with index and match:
    =INDEX(lreturn,MATCH(F3,lcc,0)) and then add if iserror I get a #Value error.
    =IF(ISERROR(INDEX(lreturn,MATCH(F3,lcc,0))),"Not Found"),INDEX(lreturn,MATCH(F3,lcc,0))

    What am I doing wrong? I use Excel 2003.
    Thanks

    itconc

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    The parentheses aren't quite correct. Try

    =IF(ISERROR(INDEX(lreturn,MATCH(F3,lcc,0))),"Not Found",INDEX(lreturn,MATCH(F3,lcc,0)))

    In fact, you only need to test whether MATCH returns an error:

    =IF(ISERROR(MATCH(F3,lcc,0)),"Not Found",INDEX(lreturn,MATCH(F3,lcc,0)))

  3. #3
    3 Star Lounger
    Join Date
    Oct 2004
    Location
    Houston, Texas, USA
    Posts
    242
    Thanks
    1
    Thanked 0 Times in 0 Posts
    [quote name='HansV' post='789567' date='18-Aug-2009 10:51']The parentheses aren't quite correct. Try

    =IF(ISERROR(INDEX(lreturn,MATCH(F3,lcc,0))),"Not Found",INDEX(lreturn,MATCH(F3,lcc,0)))

    In fact, you only need to test whether MATCH returns an error:

    =IF(ISERROR(MATCH(F3,lcc,0)),"Not Found",INDEX(lreturn,MATCH(F3,lcc,0)))[/quote]

    That did it. Thanks, Hans

Posting Permissions

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