+ Reply to Thread
Results 1 to 6 of 6

Vlookup to return blank cell when false

  1. #1
    Registered User
    Join Date
    07-30-2010
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    69

    Vlookup to return blank cell when false

    I have the following formula:

    =IF(A:A="","",IF(VLOOKUP(A:A,'XXX'!H:M,2,0),"",(VLOOKUP(A:A,'XXX'!H:M,2,0))))

    And i'm trying to get it to return a blank cell when the vlookup is false. It is however still returning a 0. Does anyone know where i'm going wrong here?

    Thanks in advance!

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    re: Vlookup to return blank cell when false

    A:A cannot be "", so I think the 0 is representing FALSE.

    You need to check a cell, or use COUNTA to check for the number of cells that aren't blank
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    07-30-2010
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    69

    re: Vlookup to return blank cell when false

    If i remove IF(A:A="","", is there another way of doing this?

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

    re: Vlookup to return blank cell when false

    IF(iserror(VLOOKUP(A1,'XXX'!H:M,2,false)),"",VLOOKUP(A1,'XXX'!H:M,2,false))
    you cant look up a:a you need a single value to look up
    "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

  5. #5
    Registered User
    Join Date
    07-30-2010
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    69

    re: Vlookup to return blank cell when false

    thanks! OK. I can live with looking up an individual cell... but this formula still returns a 0.

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

    re: Vlookup to return blank cell when false

    if the cell is empty you'll get 0
    take
    vlookup(a1,b1:c10,2,false)
    is a1 =martin and b4 = martin then you'd get whatever's is in c4 but if c4 is blank it will return 0
    you could do
    if(vlookup(a1,b1:c10,2,false)=0,"",vlookup(a1,b1:c10,2,false))
    but its probably easier just to custom format the cells
    0;-0;;@
    this will hide 0

+ 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