+ Reply to Thread
Results 1 to 10 of 10

Formula that wont count a cell if its empty

  1. #1
    Forum Contributor
    Join Date
    10-31-2010
    Location
    london
    MS-Off Ver
    Excel 365
    Posts
    150

    Formula that wont count a cell if its empty

    The title probable isnt the best discription but i didnt know how to explain it,

    what i want to due is add 3 cells and divide by 3, but if only 2 of the cells had a value then only divide by 2

    =SUM(G8+G13+G18)/3

  2. #2
    Valued Forum Contributor scottylad2's Avatar
    Join Date
    09-03-2010
    Location
    edinburgh
    MS-Off Ver
    Office 2007 Prof & Office 2010 Student Edition
    Posts
    629

    Re: Formula that wont count a cell if its empty

    SUM(G8+G13+G18)/Count(G8,G13,G18) count will ignore empty cells. If theres a 0 in a cell it will include it, if you want zero values ignored then we can create a countif of the same cells, and make the criteria ">"&0
    Windows 7 using Office 2007 & 2010

    Remember your [ code ] [ /code ] tags, makes reading soooo much easier

  3. #3
    Forum Expert Colin Legg's Avatar
    Join Date
    03-30-2008
    Location
    UK
    MS-Off Ver
    365
    Posts
    1,256

    Re: Formula that wont count a cell if its empty

    Hi,

    To directly answer your question, it would be:
    Please Login or Register  to view this content.
    Which could also be written as:
    Please Login or Register  to view this content.
    Hope that helps,

    Colin

    RAD Excel Blog

  4. #4
    Forum Contributor
    Join Date
    10-31-2010
    Location
    london
    MS-Off Ver
    Excel 365
    Posts
    150

    Re: Formula that wont count a cell if its empty

    how do you separate the numbers without using the comma as on a countif the first comma changes the syntax from range to critieria

  5. #5
    Valued Forum Contributor scottylad2's Avatar
    Join Date
    09-03-2010
    Location
    edinburgh
    MS-Off Ver
    Office 2007 Prof & Office 2010 Student Edition
    Posts
    629

    Re: Formula that wont count a cell if its empty

    Actually you can't use countif, it's with a non contiguous range. If your needing a >0 solution please say, i'm sure we can come up with one

  6. #6
    Forum Contributor
    Join Date
    10-31-2010
    Location
    london
    MS-Off Ver
    Excel 365
    Posts
    150

    Re: Formula that wont count a cell if its empty

    yes i do as the cells will always show 0 so will always divide by 3

  7. #7
    Forum Expert Colin Legg's Avatar
    Join Date
    03-30-2008
    Location
    UK
    MS-Off Ver
    365
    Posts
    1,256

    Re: Formula that wont count a cell if its empty

    If you want to ignore zeros then you could use this:
    Please Login or Register  to view this content.

  8. #8
    Valued Forum Contributor scottylad2's Avatar
    Join Date
    09-03-2010
    Location
    edinburgh
    MS-Off Ver
    Office 2007 Prof & Office 2010 Student Edition
    Posts
    629

    Re: Formula that wont count a cell if its empty

    THe cells I've used are E25,E27 & E29 and this works. Slightly longer formula than I thought but does the trick

    SUM(E25,E27,E29)/COUNT(IF(E25=0,"",E25),+COUNT(IF(E27=0,"",E29),+COUNT(IF(E29=0,"",E29))))

    Edit: this is returning a wrong value, ignore
    Last edited by scottylad2; 03-06-2011 at 07:57 PM.

  9. #9
    Valued Forum Contributor scottylad2's Avatar
    Join Date
    09-03-2010
    Location
    edinburgh
    MS-Off Ver
    Office 2007 Prof & Office 2010 Student Edition
    Posts
    629

    Re: Formula that wont count a cell if its empty

    =SUM(E25,E27,E29)/COUNT(IF(E25>0,E25,""),IF(E27>0,E27,""),IF(E29>0,E29,""))

    tested and working

  10. #10
    Forum Contributor
    Join Date
    10-31-2010
    Location
    london
    MS-Off Ver
    Excel 365
    Posts
    150

    Re: Formula that wont count a cell if its empty

    Well done Scotty your a star thank you

+ 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