+ Reply to Thread
Results 1 to 9 of 9

Distinguishing between a "0" and a "blank" cell

  1. #1
    Registered User
    Join Date
    04-25-2014
    Location
    Allentown, PA
    MS-Off Ver
    Excel 2007
    Posts
    2

    Distinguishing between a "0" and a "blank" cell

    The following formula looks through a list of names (in this case, looking for “Joe Smith”) in the monthly tab (in this case, “MARCH”) from column B and enters the calculated value associated with that name from column G. The formula works fine, but when there is no value in column G, it returns a 0% (format in the ‘receiving’ cell is set for %). This would be fine, but since it does not distinguish between a true 0% and a blank cell, this is causing a problem. Your thoughts are greatly appreciated!

    =SUMIF(MARCH!B2:B31,"Joe Smith",MARCH!$G$2:$G$31)

  2. #2
    Forum Contributor pipoliveira's Avatar
    Join Date
    08-09-2012
    Location
    Ireland
    MS-Off Ver
    Microsoft Office 365 ProPlus
    Posts
    368

    Re: Distinguishing between a "0" and a "blank" cell

    Hi bluJeans,

    Have you tried the following:

    =IF(AND(SUMIF(MARCH!B2:B31,"Joe Smith",MARCH!$G$2:$G$31)=0,SUMIF(MARCH!B2:B31,"Joe Smith",MARCH!$G$2:$G$31)=""),"",SUMIF(MARCH!B2:B31,"Joe Smith",MARCH!$G$2:$G$31))

    Let me know if that worked as desired.

    Kind regards,
    Filipe

  3. #3
    Forum Contributor
    Join Date
    12-09-2013
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    171

    Re: Distinguishing between a "0" and a "blank" cell

    Hi Filipe,

    As per your condition, you never get "blank" because you have used AND operator, so the both the conditions never TRUE, as we dont get "blank" as output for any sumif function.

    Thanks for the answer.
    Like my answer, then click * below

  4. #4
    Forum Contributor
    Join Date
    12-09-2013
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    171

    Re: Distinguishing between a "0" and a "blank" cell

    Hi,

    May be try this....

    =if(countif(MARCH!B2:B31,"Joe Smith")=0," ",(SUMIF(MARCH!B2:B31,"Joe Smith",MARCH!$G$2:$G$31))

    Thanks,
    Bhanu

  5. #5
    Forum Contributor pipoliveira's Avatar
    Join Date
    08-09-2012
    Location
    Ireland
    MS-Off Ver
    Microsoft Office 365 ProPlus
    Posts
    368

    Re: Distinguishing between a "0" and a "blank" cell

    Ok then,

    Have you tried:

    =IF(SUMIF(MARCH!B2:B31,"Joe Smith",MARCH!$G$2:$G$31)=0,"Define here what you need to show if the Sum = 0",SUMIF(MARCH!B2:B31,"Joe Smith",MARCH!$G$2:$G$31)

    Hope this one is fien for you.

    Cheers,
    Filipe

  6. #6
    Forum Contributor
    Join Date
    12-09-2013
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    171

    Re: Distinguishing between a "0" and a "blank" cell

    Hi Filipe,

    Following may be work out...


    =if(countif(MARCH!B2:B31,"Joe Smith")=0," ",(SUMIF(MARCH!B2:B31,"Joe Smith",MARCH!$G$2:$G$31))

    Thanks,
    Bhanu

  7. #7
    Registered User
    Join Date
    04-25-2014
    Location
    Allentown, PA
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Distinguishing between a "0" and a "blank" cell

    These sure seem like they should work, but did not. So I went back to my calculations in the G column in the monthly tab, thinking perhaps that is what is causing the problem:
    =IFERROR(SUM(C2+E2)/F2,"")

    I changed the “” result to “x” –hoping that would be easier to distinguish in the monthly tab; then tried changing your suggestion to:

    =IF(AND(SUMIF(MARCH!B2:B31,"Joe Smith",MARCH!$G$2:$G$31)=0%,SUMIF(MARCH!B2:B31,"Joe Smith",MARCH!$G$2:$G$31)="x"),"",SUMIF(MARCH!B2:B31,"Joe Smith",MARCH!$G$2:$G$31))

    The result was still “0%” whether there was an “x” in the monthly tab or if it was “0”.

    I'm guessing I made a silly mistake somewhere!

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

    Re: Distinguishing between a "0" and a "blank" cell

    SUM ignores text.

    If you want nothing to appear when the sum is zero, use your original formula and format the cell as 0%;-0%;
    Entia non sunt multiplicanda sine necessitate

  9. #9
    Registered User
    Join Date
    06-24-2013
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Distinguishing between a "0" and a "blank" cell

    Hi,

    I did a little mock up scenario with multiple drop cells (yellow cells), the value returned is a percentage and where 0% is returned, shows as blank ...

    =IF(VLOOKUP($A2,INDIRECT($B2&"!A:K"),7,0)/100=0,"",VLOOKUP($A2,INDIRECT($B2&"!A:K"),7,0)/100)

    ... hope this helps!
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 4
    Last Post: 11-17-2013, 12:05 PM
  2. [SOLVED] How to USE """"" cells count """"" change font color
    By austin123456 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-09-2013, 06:14 AM
  3. [SOLVED] Test for blank cell should be "True" but "False" action is taken.
    By Aceso in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 02-09-2013, 05:47 PM
  4. Replies: 3
    Last Post: 02-16-2011, 02:55 PM
  5. Replies: 3
    Last Post: 12-14-2006, 01:36 PM

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