+ Reply to Thread
Results 1 to 5 of 5

If the field a vlookup is referencing is blank, how can I stop it returning "0"

  1. #1
    Registered User
    Join Date
    02-27-2008
    Posts
    44

    If the field a vlookup is referencing is blank, how can I stop it returning "0"

    Hi

    I'm doing a vlookup from one sheet to another, but if the cell I'm looking up is blank, how do I prevent the cell containing the formula from showing as zero? If there's nothing in the reference cell, I want the formula cell to show blank too.....

    Thanks
    oj

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: If the field a vlookup is referencing is blank, how can I stop it returning "0"

    Check the cell first:

    =IF(ISBLANK(A1),"",VLOOKUP(A1,etc....
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    02-27-2008
    Posts
    44

    Re: If the field a vlookup is referencing is blank, how can I stop it returning "0"

    Sorry - I wasn't very clear in my original message.

    I want to lookup an employee's ID from another sheet and return the value in another column, however in some cases there won't be a value in that column but I don't want the lookup to return 0. I want it to just leave the cell with the formula in it blank....as that cell then drives some other formulas if it isn't blank. How can I get the cell to just remain empty if there's no value to return?

    Thanks

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: If the field a vlookup is referencing is blank, how can I stop it returning "0"

    So, you just want a null response?

    I hate having to do every vlookup calculations twice just to suppress a zero with a "", but you can. This formula just runs once to check for a zero, then runs again if no zero returns:

    =IF(VLOOKUP(D2,A2:B1000,2,FALSE)=0,"",VLOOKUP(D2,A2:B1000,2,FALSE))


    Having given that, I have to imagine it could be less plumbing to let the zeros come and adjust the formulas later that refer to those cells regarding zero values.

  5. #5
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: If the field a vlookup is referencing is blank, how can I stop it returning "0"

    You could also use a Custom Format to make the 0 appear as a blank and thereby negate need for Double Evaluation (as JB says -- best avoided)
    (Note: underlying value of 0 will persist in the cell itself)

    I don't know the range of the values you're returning (ie +ve & -ve ... or just +ve etc...) but a standard format would be:

    [=0]"";General

    for a number type format

    #,##0;[red](#,##0);

    Both would generate a blank "appearance" for value 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