+ Reply to Thread
Results 1 to 3 of 3

Excel 2007 : trouble with vlookup and ISNA formula

  1. #1
    Registered User
    Join Date
    07-05-2012
    Location
    Indiana, US
    MS-Off Ver
    Excel 2007
    Posts
    1

    trouble with vlookup and ISNA formula

    I’m using Excel 2007. When I do a vlookup it returns #N/A if the cell is empty. I want the formula to return “0” if the cell is empty. I have attached a spreadsheet. Here is the formula that I wrote in cell B3 through B7:
    =IF(ISNA(VLOOKUP($A3,$E$3:$H$6,4,FALSE)),0,VLOOKUP($A3,$E$3:$H$6,4,FALSE))

    The problem that I’m having is that there are two similar account names in my data so the result is picking up the results from a similar account name instead of giving me “0”. The two similar accounts names are ** LIFO Inventory Reserve and 16900010 - LIFO Inventory Reserve. The result for ** LIFO Inventory Reserve is incorrect (cell B6). The results should be “0”. Instead it is picking up “PM” for account 16900010 - LIFO Inventory Reserve (cell H5). Why is my formula picking up “PM”? I can’t change the account names. How can I write the formula so that it picks up “0”?
    Help is appreciated. Thanks
    Attached Files Attached Files

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

    Re: trouble with vlookup and ISNA formula

    That is because "*" is a wildcard character for VLOOKUP() function..

    Try =IF(ISNA(VLOOKUP("~"&$A3,$E$3:$H$6,4,FALSE)),0,VLOOKUP("~"&$A3,$E$3:$H$6,4,FALSE)) where the ~ cancels the wildcard.


    In Excel 2007, this might also work:

    =IFERROR(VLOOKUP("~"&$A3,$E$3:$H$6,4,FALSE),0)
    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 Contributor
    Join Date
    03-15-2007
    Location
    AL, USA
    MS-Off Ver
    2007
    Posts
    174

    Re: trouble with vlookup and ISNA formula

    Well, that's because the value you are searching for contains an asterisk (*). Excel treats these as wildcards, and so it's finding anything with "LIFO" in the cell.

    As for a workaround, try a tilde (~) before the lookup value.


    *EDIT* they need to invent insta-refresing forums lol.

+ 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