+ Reply to Thread
Results 1 to 3 of 3

Leave cell blank when sum is empty

  1. #1
    Registered User
    Join Date
    07-21-2010
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    1

    Leave cell blank when sum is empty

    Okay, I'll try to explain what I'm trying to do.

    I have three worksheets, for the sake of the argument let's call them A, B and C. Worksheet C combines the respective cell values of sheet A and B, however many cells in A and B may be empty.

    When I try to calculate the sum of two empty cells the result returned is 0. To circumvent this, I could use the following formula:

    =IFERROR('Sheet-A!C6+'Sheet-B'!C6,"",('Sheet-A!C6+'Sheet-B'!C6)

    However, this would mean that should the values in sheet A and B actually do equal 0 then the cell would remain blank. Somehow I need to differentiate between empty values and a value of zero.

    - If the sum refers to two empty cells, the result should be empty
    - If the sum =0, the result should be 0

    In a nutshell, how can I acheive this?

    Thanks!

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

    Re: Leave cell blank when sum is empty

    try
    =IF(OR(A1="",B1=""),"",A1-B1)
    or
    possibly
    =IF(and(A1="",B1=""),"",A1-B1)
    "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

  3. #3
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Leave cell blank when sum is empty

    Assuming you only want to get a sum if both cells contain values try

    =IF(COUNT('Sheet-A!C6,'Sheet-B'!C6)=2,'Sheet-A!C6+'Sheet-B'!C6,"")
    Audere est facere

+ 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