+ Reply to Thread
Results 1 to 12 of 12

How to get rid of extracted cells displaying "0"

Hybrid View

  1. #1
    Registered User
    Join Date
    08-11-2008
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013 64-bit
    Posts
    57

    How to get rid of extracted cells displaying "0"

    At the moment, when I am using VLOOKUP to extract data from another worksheet, when it is extracting a blank cell, instead of displaying it as empty on the local sheet, it displays a "0" in the cell. Here's my formula. I've tried many combos, but have given up repeatedly trying. Thanks.

    Formula: copy to clipboard
    =IF(ISNA(VLOOKUP($B21,'Season Results History (Hidden)'!$B:$Y,11,0)),"",VLOOKUP($B21,'Season Results History (Hidden)'!$B:$Y,11,0))

  2. #2
    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: How to get rid of extracted cells displaying "0"

    What's in B21 and what's in column L for a matching B21 value?
    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.

  3. #3
    Valued Forum Contributor
    Join Date
    04-30-2012
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    547

    Re: How to get rid of extracted cells displaying "0"

    If a successful lookup only finds an empty cell, then it will return 0. Even =A1 will return 0 if A1 is empty.

    There are several approaches to handle this, for example format the cells not to display zero values with custom format

    0.00,-0.00;;

    or similar, depending on the format you need.

    Or you wrap your formula in an IF statement that checks if the returned cell is empty

    =if(YourFormula="","",YourFormula)

    Or, in your specific case, since you already use an IF statement, add an OR() to the condition

    =IF(or(ISNA(VLOOKUP($B21,'Season Results History (Hidden)'!$B:$Y,11,0)),VLOOKUP($B21,'Season Results History (Hidden)'!$B:$Y,11,0)=""),"",VLOOKUP($B21,'Season Results History (Hidden)'!$B:$Y,11,0))
    Last edited by npamcpp; 06-30-2012 at 07:22 PM.
    Like a post? Click the star below it!

  4. #4
    Registered User
    Join Date
    08-11-2008
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013 64-bit
    Posts
    57

    Re: How to get rid of extracted cells displaying "0"

    Quote Originally Posted by npamcpp View Post
    If a successful lookup only finds an empty cell, then it will return 0. Even =A1 will return 0 if A1 is empty.

    There are several approaches to handle this, for example format the cells not to display zero values with custom format

    0.00,-0.00;;

    or similar, depending on the format you need.

    Or you wrap your formula in an IF statement that checks if the returned cell is empty

    =if(YourFormula="","",YourFormula)

    Or, in your specific case, since you already use an IF statement, add an OR() to the condition

    =IF(or(ISNA(VLOOKUP($B21,'Season Results History (Hidden)'!$B:$Y,11,0)),VLOOKUP($B21,'Season Results History (Hidden)'!$B:$Y,11,0)=""),"",VLOOKUP($B21,'Season Results History (Hidden)'!$B:$Y,11,0))
    That works fine, however, it is displaying "N/A" in the cells where there are no records. How can I remove these N/As so the cells remain blank?

  5. #5
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: How to get rid of extracted cells displaying "0"

    Try:

    Formula: copy to clipboard
    =IF(ISNA(YourFormulaHere,"",YourFormulaHere)


    This will put blanks where no records are found.
    Please consider:

    Thanking those who helped you. Click the star icon in the lower left part of the contributor's post and add Reputation.
    Cleaning up when you're done. Mark your thread [SOLVED] if you received your answer.

  6. #6
    Registered User
    Join Date
    08-11-2008
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013 64-bit
    Posts
    57

    Re: How to get rid of extracted cells displaying "0"

    Quote Originally Posted by abousetta View Post
    Try:

    Formula: copy to clipboard
    =IF(ISNA(YourFormulaHere,"",YourFormulaHere)


    This will put blanks where no records are found.
    Yes, but I am still getting error messages, probably not putting a parenthesis in the right place or something.

    Formula: copy to clipboard
    =IF(OR(ISNA(VLOOKUP($B107,'Season Results History (Hidden)'!$B:$Y,8,0)),VLOOKUP($B107,'Season Results History (Hidden)'!$B:$Y,8,0)=""),"",VLOOKUP($B107,'Season Results History (Hidden)'!$B:$Y,8,0))

  7. #7
    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: How to get rid of extracted cells displaying "0"

    Probably time to upload your workbook.

    When you get a moment would you also extend your profile to indicate which Excel versions you have. Knowing this can be useful since later versions of Excel have functionality that does not exist in earlier versions

  8. #8
    Valued Forum Contributor
    Join Date
    04-30-2012
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    547

    Re: How to get rid of extracted cells displaying "0"

    Quote Originally Posted by abousetta View Post
    Try:

    Formula: copy to clipboard
    =IF(ISNA(YourFormulaHere,"",YourFormulaHere)


    This will put blanks where no records are found.
    The closing bracket for the ISNA() is missing. It should be

    Formula: copy to clipboard
    =IF(ISNA(YourFormulaHere),"",YourFormulaHere)


    ACM2, your question is about avoiding the return of Zero from a formula. A zero as the result is not an error and can be handled by the techniques described above. If the formula returns #N/A, then it's an error and needs to be handled differently. You can either use a formula like the one above, or in Excel 2007 and later use

    Formula: copy to clipboard
    =IFError(YourFormulaHere,"")


    or you can prevent errors occurring in the first place by good data management. E.g. ensure that lookup value and the data in the lookup range have the same data type, no leading or trailing blanks, and more.

    As has been mentioned above, this would be easier to demonstrate with a workbook.

    Here is a good article on why Vlookup() can fail: Six Reasons Why Your VLOOKUP or HLOOKUP Formula Does Not Work
    Last edited by npamcpp; 07-02-2012 at 07:12 AM.

  9. #9
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: How to get rid of extracted cells displaying "0"

    If the first formula worked fine then this should work also:

    Formula: copy to clipboard
    =If(ISNA(IF(or(ISNA(VLOOKUP($B21,'Season Results History (Hidden)'!$B:$Y,11,0)),VLOOKUP($B21,'Season Results History (Hidden)'!$B:$Y,11,0)=""),"",VLOOKUP($B21,'Season Results History (Hidden)'!$B:$Y,11,0))),"",IF(or(ISNA(VLOOKUP($B21,'Season Results History (Hidden)'!$B:$Y,11,0)),VLOOKUP($B21,'Season Results History (Hidden)'!$B:$Y,11,0)=""),"",VLOOKUP($B21,'Season Results History (Hidden)'!$B:$Y,11,0)))

  10. #10
    Registered User
    Join Date
    08-11-2008
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013 64-bit
    Posts
    57

    Re: How to get rid of extracted cells displaying "0"

    Quote Originally Posted by abousetta View Post
    If the first formula worked fine then this should work also:

    Formula: copy to clipboard
    =If(ISNA(IF(or(ISNA(VLOOKUP($B21,'Season Results History (Hidden)'!$B:$Y,11,0)),VLOOKUP($B21,'Season Results History (Hidden)'!$B:$Y,11,0)=""),"",VLOOKUP($B21,'Season Results History (Hidden)'!$B:$Y,11,0))),"",IF(or(ISNA(VLOOKUP($B21,'Season Results History (Hidden)'!$B:$Y,11,0)),VLOOKUP($B21,'Season Results History (Hidden)'!$B:$Y,11,0)=""),"",VLOOKUP($B21,'Season Results History (Hidden)'!$B:$Y,11,0)))
    That worked fine. Thanks.

  11. #11
    Valued Forum Contributor
    Join Date
    04-30-2012
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    547

    Re: How to get rid of extracted cells displaying "0"

    Quote Originally Posted by abousetta View Post
    If the first formula worked fine then this should work also:

    Formula: copy to clipboard
    =If(ISNA(IF(or(ISNA(VLOOKUP($B21,'Season Results History (Hidden)'!$B:$Y,11,0)),VLOOKUP($B21,'Season Results History (Hidden)'!$B:$Y,11,0)=""),"",VLOOKUP($B21,'Season Results History (Hidden)'!$B:$Y,11,0))),"",IF(or(ISNA(VLOOKUP($B21,'Season Results History (Hidden)'!$B:$Y,11,0)),VLOOKUP($B21,'Season Results History (Hidden)'!$B:$Y,11,0)=""),"",VLOOKUP($B21,'Season Results History (Hidden)'!$B:$Y,11,0)))
    If avoiding both #N/A and 0 as the result is the goal, then this is a shorter way:

    Formula: copy to clipboard
    =IF(ISNA(VLOOKUP(B21,'Season Results History (Hidden)'!B:Y,11,0)),"",IF(VLOOKUP(Sheet1!B21,'Season Results History (Hidden)'!B:Y,11,0)=0,"",VLOOKUP(Sheet1!B21,'Season Results History (Hidden)'!B:Y,11,0)))

  12. #12
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: How to get rid of extracted cells displaying "0"

    As suggested earlier, it's also a good idea to have your excel version indicated in your profile. Also a brief description of your sheet helps, more information leads to more accurate answers.

    One possible answer to your question would be

    =T(IFERROR(VLOOKUP($B21,'Season Results History (Hidden)'!$B:$Y,11,0),""))

    but that would be of no use if you use excel 2003, or if the lookup results are numeric.

+ 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