+ Reply to Thread
Results 1 to 5 of 5

VLookup - return 0 instead of #NA

Hybrid View

  1. #1
    Registered User
    Join Date
    11-17-2012
    Location
    Dublin
    MS-Off Ver
    Excel 2003/2007
    Posts
    6

    VLookup - return 0 instead of #NA

    Looking for help on having the following function (If, or & VLookup) to return 0 instead of #NA when the Vlookup value is not present in sheet 1. I have seen iserror but cant seem to embed it correctly.

    =IF(OR(AC17="S",AC17="LG",AC17="NL",AC17="SAG"),"0",VLOOKUP(A17,'F:\[BDP.xls]Sheet1'!$A$1:$T$65536,13,FALSE))


    Thank you to all who provided support on query
    Last edited by Ryanaj; 11-17-2012 at 07:58 PM.

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: VLookup - return 0 instead of #NA

    =IF(OR(AC17="S",AC17="LG",AC17="NL",AC17="SAG"),"0",IF(ISNA(VLOOKUP(A17,'F:\[BDP.xls]Sheet1'!$A:$T,13,FALSE)),0,VLOOKUP(A17,'F:\[BDP.xls]Sheet1'!$A:$T,13,FALSE)))
    or slightly shorter
    =IF(OR(AC17={"S","LG","NL","SAG"}),"0",IF(ISNA(VLOOKUP(A17,'F:\[BDP.xls]Sheet1'!$A:$T,13,FALSE)),0,VLOOKUP(A17,'F:\[BDP.xls]Sheet1'!$A:$T,13,FALSE)))
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: VLookup - return 0 instead of #NA

    Maybe

    =IF(OR(AC17={"S","LG","NL","SAG"}), 0, IFERROR(VLOOKUP(A17, 'F:\[BDP.xls]Sheet1'!$A$1:$T$65536, 13, FALSE), 0))
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: VLookup - return 0 instead of #NA

    Hi,

    =IF(OR(AC17="S",AC17="LG",AC17="NL",AC17="SAG",ISERROR(VLOOKUP(A17,'F:\[BDP.xls]Sheet1'!$A$1:$T$65536,13,FALSE))),"0",VLOOKUP(A17,'F:\[BDP.xls]Sheet1'!$A$1:$T$65536,13,FALSE))
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,240

    Re: VLookup - return 0 instead of #NA

    Untested:

    =IF(OR(AC17="S",AC17="LG",AC17="NL",AC17="SAG"),"0",IF(ISNA(VLOOKUP(A17,'F:\[BDP.xls]Sheet1'!$A$1:$T$65536,13,FALSE),0,VLOOKUP(A17,'F:\[BDP.xls]Sheet1'!$A$1:$T$65536,13,FALSE))


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


+ 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