+ Reply to Thread
Results 1 to 9 of 9

Formula to calculate a sum if non of the cells in a range are blank

  1. #1
    Registered User
    Join Date
    04-21-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2007
    Posts
    13

    Formula to calculate a sum if non of the cells in a range are blank

    Hi all,
    So far I have been unsuccessful in trying to figure out a forumla that would check if any of the cells in a range (C4:C12) are blank, it would leave the total figure at C13 as "$0.00", but if ALL of the cells at C4:C12 contain anything else, the cell at C14 would calculate the sum of C13-30.
    Background: I have 9 players in the U12 basketball team that I manage who pay $6 per game so that the total at C13 is $6x9 = $54. Each week the score sheet costs $30 so C14 = C13-30.
    This is simple enough, but I need to be able to only calculate C14 as C13-30 if all of the 9 players pay for that week. If any of them don't pay, then the sum at C13 must equal $0.00.
    Hope this makes sense and thanks in advance for any help.
    Regards

  2. #2
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Formula to calculate a sum if non of the cells in a range are blank

    try :
    =IF(COUNTIF(C4:C12,">0")=ROWS(C4:C12),SUM(C13:C30),0)

    Hope this helps

    EDIT-
    or
    =IF(SUMPRODUCT(--(C4:C12<>""))=ROWS(C4:C12),SUM(C13:C30),0)
    Last edited by dredwolf; 04-21-2013 at 10:14 PM.
    A picture may be worth a thousand words, BUT, a sample Workbook is worth a thousand screenshots!
    -Add a File - click advanced (next to quick post), scroll to manage attachments, click, select add files, click select files, select file, click upload, when file shows up at bottom left, click done (bottom right), click submit
    -To mark thread Solved- go top of thread,click Thread Tools,click Mark as Solved
    If you received helpful response, please remember to hit the * of that post

  3. #3
    Valued Forum Contributor Lemice's Avatar
    Join Date
    04-13-2013
    Location
    Somewhere.
    MS-Off Ver
    Excel 2016
    Posts
    696

    Re: Formula to calculate a sum if non of the cells in a range are blank

    Hello,

    What you can use is to put a COUNTBLANK on C13, something like
    Please Login or Register  to view this content.
    (copy pasta from Ford)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools

    Regards,
    Lem

  4. #4
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Formula to calculate a sum if non of the cells in a range are blank

    @ Lemice, COUNTBLANK(), ISBLANK() only deal with truly empty cells...if a cell contains a formula that yields "", then it it considered NOT 'BLANK', and will be treated as such by those functions

  5. #5
    Valued Forum Contributor Lemice's Avatar
    Join Date
    04-13-2013
    Location
    Somewhere.
    MS-Off Ver
    Excel 2016
    Posts
    696

    Re: Formula to calculate a sum if non of the cells in a range are blank

    I tried to change any cell in my range to be ="" and the formula still works for me, eventhough if I ISBLANK it, it returns FALSE. Weird stuff ...

  6. #6
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Formula to calculate a sum if non of the cells in a range are blank

    @ Lemice, MY Apologies, it seems COUNTBLANK does work properly, ISBLANK is the real pain one..again, sorry

  7. #7
    Valued Forum Contributor Lemice's Avatar
    Join Date
    04-13-2013
    Location
    Somewhere.
    MS-Off Ver
    Excel 2016
    Posts
    696

    Re: Formula to calculate a sum if non of the cells in a range are blank

    Don't be, this gives me a better understanding about COUNTBLANK and will help me deal with "" more efficiently.
    Thanks for pointing it out actually.

  8. #8
    Registered User
    Join Date
    04-21-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Formula to calculate a sum if non of the cells in a range are blank

    Awesome!! Thank you all for the super-fast responses. I used the countblank method and it works like a treat. Brilliant.

  9. #9
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Formula to calculate a sum if non of the cells in a range are blank

    Good that you got a solution !

    Please remember to mark the thread as solved if you are satisfied with your solution :
    To mark thread "Solved", go to the top of the thread,click "Thread Tools",click "Mark as Solved"

    and remeber to hit star '*" at bottom left of Lemice's post as well

+ 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