+ Reply to Thread
Results 1 to 6 of 6

Division by Zero

  1. #1
    Forum Contributor
    Join Date
    03-30-2008
    Posts
    121

    Division by Zero

    I am struggling with a formula that in some instances needs to divide by zero.

    I am using the formula =Sum(A1:A10)/Count(A1:A10).

    In some cases there are numbers in the referenced cells and in some cases the cells are zero.

    I get the result I want if I create the formula =Sum(A1:A10) in cell A11; =Count(A1:A10) in cell A12; and =A11/A12 in cell A13. However I would like to do it in one step if possible.

    Help is always appreciated.

  2. #2
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229
    Can you post some sample data? If COUNT(A1:A10) = 0 then both =SUM(A1:A10)/COUNT(A1:A10) and = A11/A12 will return a #DIV/0 error.

    Also, have you looked at AVERAGE?
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  3. #3
    Forum Contributor
    Join Date
    03-30-2008
    Posts
    121

    Sample Data

    A1 5
    A2
    A3
    A4 3
    A5
    A6 1
    A7
    A8 9
    A9

    A few of the cells will contain numbers, however, many of the cells will be blank and some entire columns will be blank.

    I have tried =Avg(A1:A10) and get the same #### answer when the entire column is blank.

    Thanks.

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

    =IF(COUNT(A1:A10),AVERAGE(A1:A10),"")

  5. #5
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229
    What result do you want when there are no numbers to average?

  6. #6
    Forum Contributor
    Join Date
    03-30-2008
    Posts
    121

    Thanks

    Thanks, it works like a charm.

+ 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