+ Reply to Thread
Results 1 to 6 of 6

How to hide a '0' showing in a cell if no data entered

  1. #1
    Registered User
    Join Date
    03-25-2010
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    2

    How to hide a '0' showing in a cell if no data entered

    Hi All

    I'm still a noob in Excel although I have floundered around relatively succesfully for a while. I have a formula "=SUM(E28+F28+G28+H28)/(4)". If nothing is entered into cells E-H then a zero is displayed in the sum cell. I dont want to hide the cell or column, how can I get a blank cell / hide the '0' if no data is entered? Thanks

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

    Re: How to hide a '0' showing in a cell if no data entered

    There are numerous options here

    =SUM(E28:H28)/4
    and use a Custom Number Format to mask 0

    Or double evaluate the SUM and return a Formula Null (text string)

    =IF(SUM(E28:H28)=0,"",SUM(E28:H28)/4)

    which would also be written as

    =IF(SUM(E28:H28),SUM(E28:H28)/4,"")

    Note: in using SUM there is no need for the + operator (this is one of the reasons it is used - ie to avoid explicit coercion).
    Where the ranges are contiguous use a contiguous reference else delimit ranges with comma

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

    Re: How to hide a '0' showing in a cell if no data entered

    You can also choose not to display zeros in Excel's Options
    Hope that helps.

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

    Free DataBaseForm example

  4. #4
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: How to hide a '0' showing in a cell if no data entered

    Another option:

    Use Conditional Formatting to change font colour to background colour if cell value = 0

  5. #5
    Registered User
    Join Date
    09-08-2010
    Location
    Montenegro
    MS-Off Ver
    Excel 2010
    Posts
    82

    Re: How to hide a '0' showing in a cell if no data entered

    Several solutions for this simple questions; here is my penny; I personally always use DonkeyOte's method, with two variations: sometimes I want destination cell to show value as soon as one of the cells is filled in; but sometimes I want all cells to be filled in before value in destination cell is shown; so I use these formulas:

    =IF(OR(E28="",F28="",G28="",H28=""),"",SUM(E28:H28)/4)

    =IF(AND(E28="",F28="",G28="",H28=""),"",SUM(E28:H28)/4)

    Obviously, the second one produces the same result as DonkeyOte's formula, with exception that his one is simpler, but first one will keep the cell empty untill all four related cells are filled in.

    Edit: BTW, why SUM(E28:H28)/4; why not just AVERAGE(E28:H28) ? That way, if you add new columns in between E and H, they will be automatically included in average, you won't have to edit the formula.
    Last edited by froment; 10-06-2010 at 10:26 AM.

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

    Re: How to hide a '0' showing in a cell if no data entered

    Quote Originally Posted by froment
    first one [or based] will keep the cell empty untill all four related cells are filled in.
    @froment

    If the intention is to average then we assume values are to be numeric in which case the below might be simpler:

    Please Login or Register  to view this content.
    or as you say

    Please Login or Register  to view this content.
    I think the point about use of AVERAGE is more than valid though at this stage we don't know if 3 numbers and a blank should say result in divisor of 3 or 4 ?
    The answer to that determines viability of AVERAGE versus fixed divisor I think.

    Whilst I am here... regards the other suggestions, FWIW, my two pennies:

    Conditional Formatting is Super Volatile so I would always use this as method of last resort.
    In this instance given the singular condition - if the intention is to "mask" whilst maintaining underlying numeric I would say a Number Format would be preferable.

    Display Zeroes option - I would just add the caveat that this is a worksheet level setting and as such may / may not be appropriate.

+ 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